I haven't used Spriteful in a while, but I would like to improve some of the default conventions for Rails apps to assess some issues I had in the past and take some advantage of the recent improvements of Sprockets 3
Use app/assets/sprites instead.
Currently, we use the app/assets/images/sprites and app/assets/stylesheets/sprites directories of a Rails app for sprites auto discovery and output destination. Since most apps precompile everything inside the images directory by default, we end up with the source images precompiled along the combined image and stylesheet.
We could move everything to app/assets/sprites, which would outline the sprite assets apart from the rest of the images and stylesheets, and would skip the compilation of source images. Instead of having the following pattern:
Source images app/assets/images/sprites/icons/cross.png and app/assets/images/sprites/icons/ok.png.
We could support both structures before hitting 1.0.0, and emit warnings whenever necessary.
Use Manifest links
The generated stylesheets could support the link directive from Sprockets 3 to ensure that everything gets precompiled when necessary, and provide a manifest that links all the sprites in the application (not sure yet if this should be mandatory).
// app/assets/sprites/_icons.scss
//= link ./icons.png
// app/assets/sprites/all.css OR app/assets/sprites.css
//= link_tree ./text/css (or link_tree ./sprites)
Applications could simply ask to precompile the general manifest or require/import each generated stylesheet as necessary.
I haven't used Spriteful in a while, but I would like to improve some of the default conventions for Rails apps to assess some issues I had in the past and take some advantage of the recent improvements of Sprockets 3
Use
app/assets/sprites
instead.Currently, we use the
app/assets/images/sprites
andapp/assets/stylesheets/sprites
directories of a Rails app for sprites auto discovery and output destination. Since most apps precompile everything inside theimages
directory by default, we end up with the source images precompiled along the combined image and stylesheet.We could move everything to
app/assets/sprites
, which would outline the sprite assets apart from the rest of the images and stylesheets, and would skip the compilation of source images. Instead of having the following pattern:app/assets/images/sprites/icons/cross.png
andapp/assets/images/sprites/icons/ok.png
.app/assets/images/sprites/icons.png
.app/assets/stylesheets/sprites/_icons.scss
.We would have the following:
app/assets/sprites/icons/cross.png
andapp/assets/sprites/icons/ok.png
.app/assets/sprites/icons.png
.app/assets/sprites/_icons.scss
.We could support both structures before hitting 1.0.0, and emit warnings whenever necessary.
Use Manifest links
The generated stylesheets could support the
link
directive from Sprockets 3 to ensure that everything gets precompiled when necessary, and provide a manifest that links all the sprites in the application (not sure yet if this should be mandatory).Applications could simply ask to precompile the general manifest or require/import each generated stylesheet as necessary.
/cc @rafaelfranca