CodeSleeve / asset-pipeline

This Laravel 4 package provides a very simple and easy to use asset pipeline. It was heavily inspired by the Rails asset pipeline. We make use of the wonderful Assetic package to help with pre-compliation!
http://www.codesleeve.com
MIT License
489 stars 53 forks source link

Minify CSS issue #85

Closed vincentcordel closed 10 years ago

vincentcordel commented 10 years ago

Hi there,

When I use a directive with a less file, the compiled css is not minified.

Am I missing something to actually make it work?

Thanks!

vincentcordel commented 10 years ago

Note: this is also the case with a css file (not just with less)

kdocki commented 10 years ago

@musixite what version of pipeline are you using? Can you show me your manifest file and also your config.php if you have published one?

vincentcordel commented 10 years ago

I created a config file but haven't changed it (I created it just in case I need to change something later).

Here's one of my css manifest: = require ../dm/flat-ui/bootstrap/css/bootstrap.css = require ../dm/flat-ui/bootstrap/css/bootstrap-responsive.css = require ../dm/flat-ui/css/flat-ui.css = require ../dm/common-files/css/icon-font.css *= require ../dm/css/style.css

And my js: //= require ../dm/flat-ui/js/jquery-1.8.3.min.js //= require ../dm/flat-ui/js/bootstrap.min.js //= require ../dm/flat-ui/js/icon-font-ie7.js //= require ../dm/common-files/js/jquery.scrollTo-1.4.3.1-min.js //= require ../dm/common-files/js/startup-kit.js //= require ../dm/js/script.js

The css and js files are generated. The less files are properly compiled. The only thing is it's not minified.

I'm wondering: do I need to install something else (that wasn't included in your install doc)?

Thanks for your help,

kdocki commented 10 years ago

@musixite What version are you using?

vincentcordel commented 10 years ago

The latest build (installed it yesterday following your instructions).

Here's my json:

"require": {
    "laravel/framework": "4.1.*",
    "codesleeve/asset-pipeline": "dev-master"
vincentcordel commented 10 years ago

Maybe I'm looking at the wrong file?

I'm on a local machine and I'm checking the css file using the source on my browser then clicking on the generated css file (which is not minified).

Could it be that the minified css is only in production mode? If so, how can I see it when I try it locally?

Thanks again for all your support!

kdocki commented 10 years ago

@musixite if you look at the config.php you will see

    '.css' => array(
        new Codesleeve\AssetPipeline\Filters\URLRewrite,
        new EnvironmentFilter(new Assetic\Filter\CssMinFilter, App::environment()),
    ),

The environment filter is only going to run that CssMinFilter when your environment is production. If you want it to be run on every environment then just do

      new EnvironmentFilter(new Assetic\Filter\CssMinFilter, App::environment(), App::environment()),
kdocki commented 10 years ago

Let me know if this did not resolve your issue.

vincentcordel commented 10 years ago

@kdocki I just read your message today. Thanks!

I'm wondering if it's possible to have minified css on some of the environments, not all of them (i.e. staging and production but not local).

Where can I specify this (if I can)?

Thanks again!

kdocki commented 10 years ago

publish your config file and use the EnvironmentFilter() in the filters to control which environments you want to have minified...