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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gordon’s picture

JohnAlbin’s picture

This complicates the text in the config.rb file and I couldn't get it to work.

I also tried environment ||= :development with no luck.

KrisBulman’s picture

Status: Needs review » Needs work

also unable to get this to work

fubhy’s picture

Why even bother? Just use "compass compile -e production --force" :)

JohnAlbin’s picture

Status: Needs work » Closed (works as designed)

Didn't know about the --force option.

Works for me! :-)

gordon’s picture

Status: Closed (works as designed) » Needs review

I 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

$ compass compile -e production --force

I get the following output for the block.css. Also note I have turned on firesass to high light this more.

/**
 * @file
 * Block Styling
 */
@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\000039}}
.block {
  /* Block wrapper */
  margin-bottom: 1.5em;
}
@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000312}}
.block.first {
  /* The first block in the region */
}
@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000315}}
.block.last {
  /* The last block in the region */
}
@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000318}}
.block.odd {
  /* Zebra striping for each block in the region */
}
@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000321}}
.block.even {
  /* Zebra striping for each block in the region */
}
@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000324}}
.block h2.block-title {
  /* Block title */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000329}}
#block-aggregator-category-1 {
  /* Block for the latest news items in the first category */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000332}}
#block-aggregator-feed-1 {
  /* Block for the latest news items in the first feed */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000335}}
#block-block-1 {
  /* First block created with "Add block" link */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000338}}
#block-blog-recent {
  /* "Recent blog posts" block */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000341}}
#block-book-navigation {
  /* "Book navigation" block for the current book's table of contents */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000344}}
#block-comment-recent {
  /* "Recent comments" block */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000347}}
#block-forum-active {
  /* "Active forum topics" block */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000350}}
#block-forum-new {
  /* "New forum topics" block */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000353}}
#block-locale-language {
  /* Language switcher block */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000356}}
#block-menu-menu-NAME {
  /* Custom menu block */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000359}}
#block-node-recent {
  /* "Recent content" block */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000362}}
#block-node-syndicate {
  /* "Syndicate" block for primary RSS feed; see also page.css's .feed-icon */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000365}}
#block-poll-recent {
  /* "Most recent poll" block */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000368}}
#block-profile-author-information {
  /* "Author information" block for the profile of the page's author */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000371}}
#block-search-form {
  /* "Search form" block */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000374}}
#block-shortcut-shortcuts {
  /* "Shortcuts" block */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000377}}
#block-statistics-popular {
  /* "Popular content" block */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000380}}
#block-system-main-menu {
  /* "Main menu" block */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000383}}
#block-system-management {
  /* "Management" block for Drupal management menu */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000386}}
#block-system-navigation {
  /* "Navigation" block for Drupal navigation menu */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000389}}
#block-system-user-menu {
  /* "User menu" block for Drupal user menu */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000392}}
#block-system-help {
  /* "System help" block */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000395}}
#block-system-main {
  /* "Main page content" block */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\0000398}}
#block-system-powered-by {
  /* "Powered by Drupal" block */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\00003101}}
#block-user-login {
  /* "User login form" block */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\00003104}}
#block-user-new {
  /* "Who's new" block for a list of the newest users */
}

@media -sass-debug-info{filename{font-family:file\:\/\/\/Users\/gordon\/Sites\/amsa\/sites\/all\/themes\/amsa\/sass\/blocks\.scss}line{font-family:\00003107}}
#block-user-online {
  /* "Who's online" block for a list of the online users */
}

Where as when I apply the patch I have provide the block.css compiles to

.block{margin-bottom:1.5em}

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.

JohnAlbin’s picture

Issue summary: View changes
Status: Needs review » Needs work

The patch still doesn't work.

JohnAlbin’s picture

Status: Needs work » Closed (works as designed)

This isn't needed in 7.x-6.x. And the --force option works for 7.x-5.x. closing again