Comments (3)
There's nothing built-in which specifically targets this scenario. However, groups can provide a solution. Something like (untested):
// config.php
'groups' => array(
'css' => array(
'my_group' => array(
'files' => array(
'stylesheet_for_all_browsers.css',
),
'enabled' => false,
'deps' => array('my_group_ie6'),
),
'my_group_ie6' => array(
'files' => array(
'stylesheet_for_ie6.css',
),
'enabled' => false,
),
),
),
When you Casset::enable_css('my_group')
, the ie6-only group will also be enabled. If my_group is enabled to start with, you might not want to bother with the dependency stuff..
<!-- Your template -->
<!-- Render the ie6-specific group first, then it won't be rendered when you do the rest -->
<!-- [if IE6] -->
<?php echo Casset::render_css('my_group_ie6'); ?>
<![endif]-->
<?php echo Casset::render_css(); ?>
A better solution would be to add a magic value to the 'attr' property for a group (for example, 'attr' => array('ieif' => 'lt IE6')
, then remove it around line 894, and add the corresponding conditional comments on lines 913, 921, 935, and 944. You'd still have to have two groups (doing this at a sub-group level is a nightmare, due to the complexity of combining ie6-only and all-browser stylesheets), but at least the conditional comments would be automatic. Of course there's a potential gotcha if the person has gen_tags disabled.... Pull requests gladly accepted :)
from fuelphp-casset.
Another thought - we'd need to support both downlevel-hidden and downlevel-revealed comments. They could have different keys in $attr, but then someone could specify both... hrm...
from fuelphp-casset.
you dont need to do this anyway, use the brilliant Agent class built into fuel
if (Agent::browser() == 'IE' and Agent::version() < 9){
//addyour assets here
}
from fuelphp-casset.
Related Issues (20)
- combine() does not include all group files HOT 2
- Twig extension support HOT 2
- Doesn't seem to handle CSS URLs when symlinked HOT 5
- Correct base exception
- ErrorException [ Notice ]: Uninitialized string offset: 0 HOT 3
- Make composer/packagist compatibile HOT 4
- More parameters in "files" array: relative paths & '*' for globing HOT 10
- Change cache_path to public or static accessor function? HOT 2
- Add a "cache_retrieve" path HOT 1
- Cache path is not fully configurable HOT 2
- @Import issues HOT 13
- Add compatibility for inline JS/CSS groups HOT 5
- Path of js files HOT 6
- Remote assets beginning with // fail to load HOT 2
- Assets are rendered several times HOT 4
- Twig addon img_url
- Added functionality to remove assets programatically
- add support for head/footer locations
- Even if necessary, white spaces were deleted. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fuelphp-casset.