A little trick I have been using in pretty much every design I worked on that was based on Bootstrap is to automatically add a margin between grid columns when they break/collapse, i.e. are displayed vertically instead of horizontally.
Blog · Articles tagged with "sass" · show all articles »
Preface: I don't want to bash PHP too much here, it is what it is, but I think it is clear that the Ruby community has put much more work into developing great tools to use while programming over the years, so any Ruby developer getting into PHP development should try and take some of those nice tools with her!
This week I had to start doing some PHP development, for the first time in about a year. Being a Ruby developer, I dreaded this moment, mostly because I am not so well-versed in PHP to avoid those little annoyances and inconsistencies that the language has accumulated over the years (or rather decades).
Update January 15 2016: As someone pointed out in a comment on the gist, this method doesn't seem to work anymore with recent versions of Sprockets.
Update May 29 2013: The name of the stylesheet files was changed slightly (hyphen replaced by underscore) after feedback in the comments.
In any Rails 3.1 (or newer) app where the user can change the style (e.g. layout, colors, dimensions) of certain items you come to the point where you wish you could use all of the sweetness of the Rails asset pipeline to generate custom stylesheets dynamically during runtime.
After a bit of googling I realized what it comes down to is imitating the process Rails performs when precompiling all assets on deploy, only that we want to want to compile Sass code that was generated dynamically, not read from a static file in
assets:precompile Rake task which does the heavy lifting it's clear that
Sprockets::StaticCompiler is the main suspect in this case.