Reputation: 15374
I was wondering how i get Sass and the asset pipeline to work in my Sinatra app, from what i have read it is loaded quicker than CSS and I can compress my files upon precompile and cache my assets? Plus i would like to be able to have one application.scss stylesheet and @import all my other stylesheets
I'm used to using Rails a bit so am a little spoilt in the fact that everything is done for you configuration wise.
I want to improve the performance of rendering my assets and at the moment all i can think of doing is minifying my js and css and then pushing that to my server
Any help appreciated
Thanks
Upvotes: 0
Views: 562
Reputation: 346
Have a look at Sinatra Asset Pipeline. It’s a gem that implements a Rails-like asset preprocessing engine using Sprockets.
I usually use Grunt to handle the assets when working with Sinatra. I have a Grunt task that watches for file changes in /assets/
and then compiles the files to /public/
where they’re accessible to the Sinatra app. Also I exclude the compiled files in /public/
from version control to only have the source in there. I found Grunt to give me a little more freedom and it allows for more complex configuration options.
For caching it depends a little more on the server setup and whether you can set the right Cache-Control
and Expires
headers for the css files.
Upvotes: 1