How can I stop Padrino from putting the compiled SASS into my public / directory? Or should I?

I play with Padrino, experimenting with a very minimal site at the moment without a database and just a few HAML and SASS files in the app / directory.

I noticed that every time I create a page that references the stylesheet defined in the .sass file, it compiles the stylesheet in .css and saves it under public /.

All this is very good, but I also have some static assets stored in the public /, including images and some other handwritten .css files.

This means that my public / catalog becomes a mixture of the things that I posted there and the things compiled by Padrino. So, it will show you a lot of .css files, some of which are compiled .sass files, and some of them are my first static assets. This is confusing.

Is there a way to stop Padrino (or Sinatra, or Rack, or something else) from saving these compiled files during development and keeping my post / clear?

Alternatively, can someone explain why what I ask is a bad idea / in design / should I learn to love it instead ?:-)

Thanks.

+4
source share
2 answers

I do not know how to set the SASS settings for Padrino, I looked and did not find anything useful. I would be a little nervous too if I ran it too, it could easily get confused and useless, and what if the asset names collide?

What you can do is not add SASS via Padrino, and then run it yourself, either using the --watch switch, or through something like Guard . This way you can also specify different subfolders in the public directory (images / css / js, etc.), which is what I do (although this means that you need to remember to add the subfolder as part of the path when describing links ) An application doesn’t even need to know that you are using SASS and precompiling when it’s just definitely better than the one you’re currently receiving (IMO).

You can try the Padrino mailing list for help on these settings.

0
source

Using padrino-sprockets gems, I also wanted to change the default directory / public / stylesheets to / assets / stylesheets, where the stars pick them up. I found that my padrino project, genereated with the -c sass option, had the file / lib / sass _plugin.rb with the following:

 # Enables support for SASS template reloading for rack. # Store SASS files by default within 'app/stylesheets/sass' # See http://nex-3.com/posts/88-sass-supports-rack for more details. module SassInitializer def self.registered(app) require 'sass/plugin/rack' Sass::Plugin.options[:template_location] = File.join(Padrino.root, "app/stylesheets") Sass::Plugin.options[:css_location] = File.join(Padrino.root, "public/stylesheets") app.use Sass::Plugin::Rack end end 

Path editing: css_location and restarting Padrino did the trick!

0
source

All Articles