Created
November 8, 2011 17:43
-
-
Save dhiemstra/1348501 to your computer and use it in GitHub Desktop.
cause
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sass/importers' | |
# This monkey patches the SASS filesystem importer to work with files | |
# that are named *.css.scss. This allows us to be compatible with both | |
# Rails 3.0.* and Rails 3.1 | |
# | |
# This should only be loaded in Rails 3.0 apps. | |
class Sass::Importers::Filesystem | |
# We want to ensure that all *.css.scss files are loaded as scss files | |
def extensions_with_css | |
extensions_without_css.merge('{css.,}scss' => :scss) | |
end | |
alias_method_chain :extensions, :css | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sass/importers' | |
# This monkey patches the SASS filesystem importer to work with files | |
# that are named *.css.scss. This allows us to be compatible with both | |
# Rails 3.0.* and Rails 3.1 | |
# | |
# This should only be loaded in Rails 3.0 apps. | |
class Sass::Importers::Filesystem | |
# We want to ensure that all *.css.scss files are loaded as scss files | |
def extensions_with_css | |
extensions_without_css.merge('css.scss' => :scss) | |
end | |
alias_method_chain :extensions, :css | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Since we implemented active_admin the dev environment of everyone on our team became really slow. | |
Every request took like 60 seconds so i decided to debug it a bit. | |
After a while i found out that on every request SASS was recompiling all our sass files. Because we split all css nicely we have like 40-50 stylesheets and this took a while to compile. | |
Debugging more and more inside SASS code i found out the `Sass::Importers::Filesystem#mtime` always returned nil on every found scss file and this resulted in SASS always recompile all the css files. | |
This only happend to projects that use `app/stylesheets/file.scss` as file format instead of `app/stylesheets/file.css.scss`. | |
Anyway the fix is simple, see next attached file. | |
If you want more background info take a look at: `Sass::Importers::Filesystem#possible_files` which is the method generating the `glob` syntax for Sass mtime checker. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment