Comments (7)
Yes that is possible. Use the name of the collection for the filter. Check
out the wiki :)
On Oct 7, 2012 6:29 AM, "alexshelkov" [email protected] wrote:
Is it possible to apply filters on collection after all assets are glued
together, instead of applying filter to each asset in collection?—
Reply to this email directly or view it on GitHubhttps://github.com//issues/46.
from assetmanager.
Yes, I am trying to do it:
'resolver_configs' => array(
'map' => array(
'twitter-aaa/bootstrap.less' => __DIR__ . '/../assets/twitter/bootstrap.less',
'twitter-bbb/variables.less' => __DIR__ . '/../assets/twitter/variables.less'
),
'collections' => array(
'twitter-test/bootstrap.css' => array(
'twitter-bbb/variables.less',
'twitter-aaa/bootstrap.less',
),
),
),
'filters' => array(
'twitter-test/bootstrap.css' => array(
array(
'filter' => 'LessPhp',
),
),
),
twitter-bbb/variables.less:
@red: red;
.var-test {
color: @red;
}
twitter-test/bootstrap.css:
@black: black;
.bot-test {
color: @red;
background-color: @black;
}
Output:
.var-test {
color: red;
}
.bot-test {
color: ;
background-color: black;
}
It seems that LessPhp filter applied individually on each asset, instead of applying once on glued asset.
from assetmanager.
I'm not seeing green being defined anywhere. But it looks like you're simply doing it wrong. Variables go first, then the content. You have them mixed. As for twitter bootstrap, I'm working on a module where this IS working. You may take a look at that: SxBootstrap. It's not finished yet, but I think that it's a start for you (still working on it now).
from assetmanager.
I update my prev. comment. Pls check it again.
Variables go first, then the content. You have them mixed.
It is not important when variables goes, LESS allow it until they defined before they are used. This code is parsed correctly:
@black: black;
.bot-test {
color: @red;
background-color: @black;
}
@test: 5px + 5px;
.tt {
border: @test;
}
But even if I move all variables to twitter-bbb/variables.less, it is not working.
I think that its because LESS filter applied on twitter-bbb/variables.less after that it applied on twitter-aaa/bootstrap.less, and after that result of filtering is glued together.
from assetmanager.
Alex, that's not the expected behavior. I'm actually doing the same with my module and it's working just fine. That's why I asked you to check it out. Usually you have an entry file with imports, otherwise they will be parsed the way they are right now. Try creating one file holding the imports (which I recommend doing anyway).
from assetmanager.
Alex, that's not the expected behavior. I'm actually doing the same with my module and it's working just fine. That's why I asked you to check it out.
I really check it out. I even add small portion of code in LessphpFilter:
public function filterLoad(AssetInterface $asset)
{
$root = $asset->getSourceRoot();
$path = $asset->getSourcePath();
echo "$path\n";
Its output:
variables.less
bootstrap.less
Which confirms that asset filtered individually by Less. If it is normal, I accept it, and try to find other way to solve my problem.
Usually you have an entry file with imports, otherwise they will be parsed the way they are right now. Try creating one file holding the imports (which I recommend doing anyway).
It works, if all vars defined and used in the same asset. So import is working perfectly fine.
from assetmanager.
It is expected behavior. See for yourself: https://github.com/kriswallsmith/assetic/blob/master/src/Assetic/Asset/AssetCollection.php#L143. AssetManager allows you to apply filters to nested values, where as collections apply filters to each individual element as well, and then puts them together. If you wish to apply filters to groups, your best bet would be to use the imports. Like I said earlier, that's probably better anyway :) I'm considering this issue closed, I hope this helped!
from assetmanager.
Related Issues (20)
- Support for EventManager & ServiceManager 3.0 HOT 6
- Append last modified date to Asset View Helper even withoud cache HOT 5
- FilePathCache throws exceptions almost every release HOT 13
- AssetManager is not installable with new skeleton application HOT 8
- PHP Fatal error: Uncaught TypeError: Argument 2 passed to AssetManager\Service\AssetCacheManager::setCache() must implement interface Assetic\Asset\AssetInterface, null given HOT 8
- Bower components and image paths HOT 2
- Wrong MIME type when converting asset HOT 2
- Asset not loaded on latest ZendSkeletonFramework HOT 2
- How to create a resolver that remap extension? HOT 4
- Create Seperate "Core" repository and package HOT 8
- Caching/Processing assets without asset() view helper HOT 3
- node: Permission denied HOT 1
- How to add a response header - Last-Modified, E-Tag HOT 1
- unable to load AssetManager HOT 1
- Asset view helper not work with ZF3 with basic documentation configuration. ZF3 use his own Asset view helper. HOT 1
- asset view helper BC HOT 10
- Can't install via composer due to version locks HOT 18
- Composer Version 2x HOT 1
- packagist versions not auto updated HOT 3
- laminas/laminas-dependency-plugin 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 assetmanager.