CodeSleeve / asset-pipeline

This Laravel 4 package provides a very simple and easy to use asset pipeline. It was heavily inspired by the Rails asset pipeline. We make use of the wonderful Assetic package to help with pre-compliation!
http://www.codesleeve.com
MIT License
489 stars 53 forks source link

Granularity in directories that contain both JS/CSS #66

Closed v closed 10 years ago

v commented 10 years ago

Asset Pipeline behaves great when you've got directories in the path that only contain either stylesheets or javascript.

But as soon as you do something like:

[ 'paths' => 
     '/path/to/dir/' => 'stylesheets,javascripts',
]

there are parts of the system that don't work exactly well. For example, let's say you have

/path/to/dir/file.css
/path/to/dir/file.js

In my mind, you should be able to

require file

in both your application.css and application.js and get paths to the appropriate files in both the CSS and the JS. Currently, it will generate a path to /path/to/dir/file.js for both requires.

Other than this, there is also an issue with MIME Types of files being served.

I could be serving,

/path/to/dir/styles.css
/path/to/dir/scripts.js

Both of them are served with MIME Type application/javascript by the Asset Pipeline Controller even though one of them is a clearly a stylesheet. We shouldn't conclude something is a JS file, if it simply exists in a folder that could contain JS.

kdocki commented 10 years ago

Yeah, I am fixing this in the refactor branch.

kdocki commented 10 years ago

@v Should be fixed in 1.4. You can set mime types now. You will have to re-setup your config if you published it though.