You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rails is resolving assets url as assets/.js. It maps this to app/assets/jaavscripts/.js and vendor/assets/javascripts/*.js. app files gets priortiy then the vendor files.
I love jammit and would like to know if there is a way to enter assets/*.js url instead of explicit vendor or app url relative to root path in assets.yml file.
Please pardon my ignorance if something like this already exist and I am not aware of the same.
After little more investigation, I am not able to make jammit work with rails 3.1 vendor assets. on giving vendor/assets/javascripts/*.js, it gives same path in my html.
I agree with Serek. After trying out sprockets, I feel jammit is far more intuitive. Specifically, I like the way jammit manages all assets under one roof (assets.yml) and asset extensions such as template etc. I certainly miss jammit big time in rails 3.1. Also, one should have option to choose asset pipeline engine. Isn't that a fundamental rails philosophy?
I tried to use it. I am stuck at urls. How should I refer assets within assets.yml. Here's my assets.yml file. I have a simple test.js under assets/javascripts folder. I dont see the ref of test.js in the html output.
config/assets.yml
compress_assets: off
javascripts:
workspace:
- assets/javascripts/test.js
Is there a plan to allow reference to assets placed under assets/ folder. Also would one has to fall back on barista for coffeescript and compass for sass or can I use assets pipelining provided by tilt/sprockets?
No, there are no plans to allow assets to be placed under the assets folder -- they need to be somewhere publicly accessible by the web server. "public" is a great place for that. I don't know about what level of sprockets integration you'll be able to get -- you'll have to ask the sprockets folks about that.
@bhavinkamani -- I've always had my assets in app/javascripts and app/stylesheets. It's actually quite easy to use jammit with this set up. All you need to do is symlink public/app/javascripts => app/javascripts. I have a hook in my config/environments/development.rb to do it automatically:
# Symlink javascripts and stylesheets on the fly.config.after_initializedoif !File.exists?(File.join(Rails.root,'public','app'))Rails.logger.info"Linking from public/ to app/javascripts and app/stylesheets for Jammit's helpers."`mkdir -p #{Rails.root}/public/app``ln -s #{Rails.root}/app/javascripts #{Rails.root}/public/app/javascripts``ln -s #{Rails.root}/app/stylesheets #{Rails.root}/public/app/stylesheets`endend
This way, in development when the assets are not packaged, the URLs work.
Thanks @agibralter for your reply. Thats a neat approach.
I liked the way tilt takes care of abstracting template engines. Similarly I like the way jammit takes care of asset packaging through one config file. Right now, it appears to me that if I want to use tilt I have to use sprockets or I have to use jammit with barista, compass and other separate gems for each templates. I would have liked to disable sprockets and enable jammit integrated with tilt. Not sure if there is already a way and I am missing something?
Activity
bhavinkamani commentedon Jun 3, 2011
After little more investigation, I am not able to make jammit work with rails 3.1 vendor assets. on giving vendor/assets/javascripts/*.js, it gives same path in my html.
I have a hunch that I am missing something silly.
serek commentedon Jun 15, 2011
Ok, but there needs to be a way of running Jammit with rails 3.1 ?
bhavinkamani commentedon Jun 15, 2011
I agree with Serek. After trying out sprockets, I feel jammit is far more intuitive. Specifically, I like the way jammit manages all assets under one roof (assets.yml) and asset extensions such as template etc. I certainly miss jammit big time in rails 3.1. Also, one should have option to choose asset pipeline engine. Isn't that a fundamental rails philosophy?
jashkenas commentedon Jun 15, 2011
Jammit should work fine with Rails 3.1. Just use it as you would normally.
bhavinkamani commentedon Jun 15, 2011
I tried to use it. I am stuck at urls. How should I refer assets within assets.yml. Here's my assets.yml file. I have a simple test.js under assets/javascripts folder. I dont see the ref of test.js in the html output.
config/assets.yml
app/views/layoutsapplication.html.erb
jashkenas commentedon Jun 15, 2011
You wouldn't put JavaScripts in "assets" -- you'd leave them in "public", as before.
vandrijevik commentedon Jun 15, 2011
Whoops, my bad! Deleted my misleading comment.
bhavinkamani commentedon Jun 15, 2011
Thanks a lot Jeremy... That works fine.
Is there a plan to allow reference to assets placed under assets/ folder. Also would one has to fall back on barista for coffeescript and compass for sass or can I use assets pipelining provided by tilt/sprockets?
jashkenas commentedon Jun 15, 2011
No, there are no plans to allow assets to be placed under the assets folder -- they need to be somewhere publicly accessible by the web server. "public" is a great place for that. I don't know about what level of sprockets integration you'll be able to get -- you'll have to ask the sprockets folks about that.
agibralter commentedon Jun 16, 2011
@bhavinkamani -- I've always had my assets in
app/javascriptsandapp/stylesheets. It's actually quite easy to use jammit with this set up. All you need to do is symlinkpublic/app/javascripts => app/javascripts. I have a hook in myconfig/environments/development.rbto do it automatically:This way, in development when the assets are not packaged, the URLs work.
bhavinkamani commentedon Jun 16, 2011
Thanks @agibralter for your reply. Thats a neat approach.
I liked the way tilt takes care of abstracting template engines. Similarly I like the way jammit takes care of asset packaging through one config file. Right now, it appears to me that if I want to use tilt I have to use sprockets or I have to use jammit with barista, compass and other separate gems for each templates. I would have liked to disable sprockets and enable jammit integrated with tilt. Not sure if there is already a way and I am missing something?
fluxsaas commentedon Sep 19, 2011
you could add your folder to the assets pipeline path:
i have my .js packed there.