Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In the command line syntax for sass/compass it is possible to pass the environment variable.
compass compile -e=production
A small change to the config.rb will allow the system to set this flag based upon the switch.
# Default to development if environment is not set.
saved = environment
if (environment.nil?)
environment = :development
else
environment = saved
end
Above will allow you to use the switch to change the environment variable.
Comment | File | Size | Author |
---|---|---|---|
#1 | 0001-Allow-environment-to-be-set-from-the-e-command-line-.patch | 902 bytes | gordon |
Comments
Comment #1
gordon CreditAttribution: gordon commentedHere is a patch
Comment #2
JohnAlbinThis complicates the text in the config.rb file and I couldn't get it to work.
I also tried
environment ||= :development
with no luck.Comment #3
KrisBulman CreditAttribution: KrisBulman commentedalso unable to get this to work
Comment #4
fubhy CreditAttribution: fubhy commentedWhy even bother? Just use "compass compile -e production --force" :)
Comment #5
JohnAlbinDidn't know about the --force option.
Works for me! :-)
Comment #6
gordon CreditAttribution: gordon commentedI have done some more tests. I create a competely new zen subtheme with this patch applied.
As it is now, when I run the following command
I get the following output for the block.css. Also note I have turned on firesass to high light this more.
Where as when I apply the patch I have provide the block.css compiles to
As you can see without the patch the css is being created using development mode.
I have put this back to "needs review" because without the patch the enviroment variable can't be altered from the command line without the above patch.
Comment #7
JohnAlbinThe patch still doesn't work.
Comment #8
JohnAlbinThis isn't needed in 7.x-6.x. And the --force option works for 7.x-5.x. closing again