Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glob paths when resolving CSS dependencies #21

Closed
berarma opened this issue Feb 9, 2016 · 9 comments
Closed

Glob paths when resolving CSS dependencies #21

berarma opened this issue Feb 9, 2016 · 9 comments
Assignees
Labels
Milestone

Comments

@berarma
Copy link
Contributor

berarma commented Feb 9, 2016

I think glob paths don't work when resolving CSS dependencies. The function that searches the file uses file_exists directly on the path setting and the file name.

[css]
paths[] = WEBROOT/css/*
[public.css]
files[] = public/base.less

This will check for the file "WEBROOT/css/*/public/base.less".

@markstory markstory modified the milestone: 1.0.4 Feb 9, 2016
@markstory
Copy link
Owner

I'll take a look. Globbing should work.

@markstory markstory added the bug label Feb 9, 2016
@markstory markstory self-assigned this Feb 9, 2016
@markstory
Copy link
Owner

Where are you seeing that WEBROOT/css/*/public/base.less is being checked by file_exists? I took a look at the test cases and /* is correctly expanded by AssetScanner for both CSS and JS files.

@berarma
Copy link
Contributor Author

berarma commented Feb 13, 2016

@markstory
Copy link
Owner

Ok. Which less filter are you using?

@berarma
Copy link
Contributor Author

berarma commented Feb 15, 2016

LessCss.

@markstory
Copy link
Owner

OK, I'll see if I can reproduce this problem on my side.

@berarma
Copy link
Contributor Author

berarma commented Mar 9, 2016

I've just looked at the AssetScanner tests too and that's not where the problem lies. See this back trace and you'll see there's no AssetScanner involved. AssetScanner correctly expands the glob paths at initialization but the CssDependencyTrait code doesn't use that, it uses the raw paths instead.

#0  MiniAsset\Filter\LessCss->_findFile(variables.less) called at [/home/xxxxx/vendor/markstory/mini-asset/src/Filter/CssDependencyTrait.php:64]
#1  MiniAsset\Filter\LessCss->getDependencies() called at [/home/xxxxx/vendor/markstory/mini-asset/src/Output/FreshTrait.php:93]
#2  MiniAsset\Output\AssetCacher->isFresh() called at [/home/xxxxx/vendor/markstory/asset_compress/src/Routing/Filter/AssetCompressorFilter.php:65]
#3  AssetCompress\Routing\Filter\AssetCompressorFilter->beforeDispatch() called at [/home/xxxxx/vendor/cakephp/cakephp/src/Routing/DispatcherFilter.php:145]
#4  Cake\Routing\DispatcherFilter->handle() called at [/home/xxxxx/vendor/cakephp/cakephp/src/Event/EventManager.php:390]
#5  Cake\Event\EventManager->_callListener() called at [/home/xxxxx/vendor/cakephp/cakephp/src/Event/EventManager.php:356]
#6  Cake\Event\EventManager->dispatch() called at [/home/xxxxx/vendor/cakephp/cakephp/src/Event/EventDispatcherTrait.php:78]
#7  Cake\Routing\Dispatcher->dispatchEvent() called at [/home/xxxxx/vendor/cakephp/cakephp/src/Routing/Dispatcher.php:62]
#8  Cake\Routing\Dispatcher->dispatch() called at [/home/xxxxx/webroot/index.php:37]

For my case I've solved it using a directory path without stars, but since it's a deviation from the expected behavior I guess it should be fixed or at least warn about this caveat.

@markstory
Copy link
Owner

Thanks for that tip. I'll take a look.

markstory added a commit that referenced this issue Mar 13, 2016
Expand paths before creating asset targets. This ensures that paths have
been expanded when filters get configured from the asset target.

Refs #21
@markstory
Copy link
Owner

Pull request up now. Looks like this was caused by how asset targets were created. They were being created with un-expanded glob paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants