<p>I don't think there's anything built into Craft. What I do is</p>

<pre><code>{% if craft.config.devMode %}
  &lt;link rel="stylesheet" href="{{craft.config.environmentVariables['assetURL']}}css/style.css"&gt;
{% else %}
  &lt;link rel="stylesheet" href="{{craft.config.environmentVariables['assetURL']}}css/style.min.css"&gt;
{% endif %}
</code></pre>

<p>I use <code>devMode</code> to control whether or not I want the minified css, and I use <a href="http://gruntjs.com/" rel="nofollow">grunt</a>'s <a href="https://github.com/gruntjs/grunt-contrib-cssmin" rel="nofollow">cssmin task</a> to build my minified css.</p>

CC BY-SA 3.0
2014-12-07T09:18:02.987Z
That  is a great tip for front end CSS. However, I am referring to resources for crafts control panel. I cleaned up the question to clear that up.
Jason McCallister
CC BY-SA 3.0
2014-12-06T19:50:43.077Z
2014-12-06T19:50:43.077Z
Marion Newlevant
<p>Is there a way to compress the Craft CSS for a specific environment?</p>
<p>Currently there is a setting for Javascript, <code>useCompressedJs</code>, set to true by default.</p>
<blockquote>
<p><strong>useCompressedJs</strong></p>
<p>Tells Craft whether to use compressed Javascript files whenever possible, to cut down on page load times.</p>
<p><a href="https://craftcms.com/docs/config-settings#useCompressedJs" rel="nofollow noreferrer">https://craftcms.com/docs/config-settings#useCompressedJs</a></p>
</blockquote>
<p>Is it possible to have a similar option in general.php for CSS?</p>

<control-panel><multi-environment><performance>
Compress Craft Control Panel CSS and JS per environment
# Compress Craft Control Panel CSS and JS per environment

(Asked by: username_0 on 2014-12-06)

Is there a way to compress the Craft CSS for a specific environment?

Currently there is a setting for Javascript, `useCompressedJs`, set to true by default.

> **useCompressedJs**
>
> Tells Craft whether to use compressed Javascript files whenever possible, to cut down on page load times.
>
> <https://craftcms.com/docs/config-settings#useCompressedJs>

Is it possible to have a similar option in general.php for CSS?

**Tags:** control-panel, multi-environment, performance

---

## 1 answers

### Answer by username_1 on 2014-12-06. Score: 3

I don't think there's anything built into Craft. What I do is
{% if craft.config.devMode %}
  
{% else %}
  
{% endif %}

I use devMode to control whether or not I want the minified css, and I use grunt's cssmin task to build my minified css.

> **Comments:**
> **username_0**: That  is a great tip for front end CSS. However, I am referring to resources for crafts control panel. I cleaned up the question to clear that up.  

---

