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

File not found with custom file extension #97

Closed nettles-jarrod closed 10 years ago

nettles-jarrod commented 10 years ago

I'm working on an Ember application and am trying to use the EmberPrecompileFilter to precompile handlebars templates. Sprockets is having some trouble location any file with a .hbs file extension.

/app/config/packages/codesleeve/asset-pipeline/config.php

//etc, etc

 '.hbs'   => array (
    new Assetic\Filter\EmberPrecompileFilter()
),

/app/assets/javascripts/application.js

//= require myapp                     <-- works
//= require_tree myapp/controllers    <-- works
//= require_tree myapp/templates      <-- does not work (filled w/ .hbs files)
//= require myapp/application         <-- does not work (single .hbs file)
//= require myapp/application.hbs     <-- does not work (single .hbs file)

This is just to illustrate that it isn't finding the file(s) on any path with any extension. I have loaded coffeescript files into the same folder and Sprockets has no trouble locating those files. It is only files with custom file extensions - in this case, .hbs extensions.

Throws an exception:

image

Is there an additional configuration option I'm missing? Or is this a bug in asset-pipeline/sprockets?

kdocki commented 10 years ago

@Blackshawk looks like you created a filter for .hbs but did you place .hbs into your mimes too? You need to tell sprockets it is a javascript type.

nettles-jarrod commented 10 years ago

That was the problem. Seems strange that it appears not to see the file in the filesystem - is that expected behavior?

kdocki commented 10 years ago

Yeah, I don't bring in assets for unidentified mime types because if you have like foobar.png and foobar.js then you wouldn't want foobar.png showing up in your application.js manifest file. So basically you have to tell sprockets the valid extensions for javascripts and stylesheets.