jackboberg / codeigniter-assets Goto Github PK
View Code? Open in Web Editor NEWAsset Management for CodeIgniter Framework
Asset Management for CodeIgniter Framework
First of all, thanks for the library.
I've got this config.php:
$config['script_dirs'] = array('assets/script/');
$config['style_dirs'] = array('assets/style/');
$config['cache_dir'] = 'assets/cache/';
$config['combine_css'] = TRUE;
$config['minify_css'] = TRUE;
$config['combine_js'] = TRUE;
$config['minify_js'] = TRUE;
$config['auto_update'] = FALSE;
$config['static_cache'] = TRUE;
controllers/home.php
class Home extends CI_Controller {
public function index()
{
$this->load->library('assets');
$this->load->helper('assets');
$this->assets->add('common/app.css');
}
}
Folder structure:
application/
assets/styles/cache/
assets/styles/common/app.css
system/
index.php
app.css:
@charset 'UTF-8';
* {
outline: 0 !important;
}
html, body {
width: 100%;
height: 100%;
}
On cache folder, now I've got those files:
main.min.css
store.json
and the content of main.min.css, is the same of the original. Why? I don't understand this…
PS: sorry for my english.
Hi I'm newbie on codeigniter and looking some library/helper for manage my assets.
Just curious why don't pass $CI as reference but as copied? Wouldn't it be faster if pass as ref?
take a brief look on the source code, it seems we have to pass config param each time we are going to use the library. is it correct? can we put all the config on config/assets.php, so doesnt need to define config param each time we're going to use the library?
thx
Hi,
Thanks for your lib, I'm just trying now but it seems to be the one ;-)
In my CI config file I got an "url_suffix" which is '.html'
and the link generated is like ".css.html" so I've just modified the line 737 (assets library file) to fix that.
-- $url = site_url($dir . $path);
++ $url = base_url($dir . $path);
Hope that helps
Vinz
Code from my header view:
load->helper('assets'); $assets = array( 'main.css', 'theme/theme_style.css', ); add_assets($assets); echo get_assets(); ?>it dishaply:
----------------- My directories structure: --------------- application public_html ...|_assets .......|_cache/604016905a30921163fced20a4d75f87.css --cache file forever is empty !!! .......|_css/main.css, ............|_theme/theme_style.css system etc.. ------------------------ my config: --------------------------- $config['script_dirs'] = array('js/'); $config['style_dirs'] = array('css/'); $config['cache_dir'] = 'assets/cache/'; $config['combine_css'] = TRUE; $config['minify_css'] = TRUE; $config['combine_js'] = TRUE; $config['minify_js'] = TRUE; $config['auto_update'] = TRUE; $config['static_cache'] = FALSE;Hi,
I use CI environment, where in config is:
$config['index_page'] = 'index.php';
Then i add static asset (CSS) with
$this->assets->add('example.css')
In view is output get_styles(). Here i need URL to my asset "http://example.com/example.css" or "/example.css", but i get "http://example.com/index.php/example.css". I know, that here is specific case, but i think, that library must always right be.
I can't seem to gzip compress the cached css/js files that are generated.
They have the correct Content-Type but they just won't respond. Any idea how to remedy this?
I am using the following in my .htaccess:
# ----------------------------------------------------------------------
# Gzip compression
# ----------------------------------------------------------------------
<IfModule mod_deflate.c>
# Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
</IfModule>
</IfModule>
# Compress all output labeled with one of the following MIME-types
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE application/atom+xml \
application/javascript \
application/json \
application/rss+xml \
application/vnd.ms-fontobject \
application/x-font-ttf \
application/xhtml+xml \
application/xml \
font/opentype \
image/svg+xml \
image/x-icon \
text/css \
text/html \
text/plain \
text/x-component \
text/xml
</IfModule>
</IfModule>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.