brunch / terser-brunch

A javascript minifier for brunch files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plugin not processing

jsilvestre opened this issue · comments

Hello,

I'm running into a problem: I recently wanted to compress my JS files so I installed the plugin. Apparently, it's not working for some reason (same thing with brunch-clean-css). Could you please open my eyes on what I am doing wrong, please?

Here is my package.json

{
  "dependencies": {
    "javascript-brunch": "1.7.1",
    "css-brunch": "1.7.0",
    "coffee-script-brunch": "1.8.0",
    "stylus-brunch": "1.8.0",
    "jade-brunch": "1.8.1",
    "uglify-js-brunch": "1.7.7",
    "clean-css-brunch": "1.7.1",
    "coffeelint-brunch": "1.7.0"
  }
}

And my config.coffee:

module.exports.config =
    files:
        javascripts:
            joinTo:
                'javascripts/app.js': /^app/
                'javascripts/vendor.js': /^vendor/
            order:
                # Files in `vendor` directories are compiled before other files
                # even if they aren't specified in order.
                before: [
                    'vendor/scripts/jquery-1.11.0.js'
                    'vendor/scripts/underscore-1.5.2.js'
                    'vendor/scripts/backbone-1.1.0.js'
                    'vendor/scripts/backbone.babysitter.js'
                    'vendor/scripts/backbone.projections.js'
                ]

        stylesheets:
            joinTo: 'stylesheets/app.css'
            order:
                before: ['vendor/styles/normalize.css']
                after: ['vendor/styles/helpers.css']

        templates:
            defaultExtension: 'jade'
            joinTo: 'javascripts/app.js'

    plugins:
        uglify:
            mangle: false
            compress:
                global_defs:
                    DEBUG: false
        cleancss:
            keepSpecialComments: 0
            removeEmpty: true

I think this could come from the fact I'm using Coffee to write JS and Stylus to write CSS (for clean-css' case) but I didn't manage to 1°) be 100% sure it's the reason 2°) found a solution for that.

Thank you in advance!

Optimizer plugins are not enabled by default because they are not usually
desired during a typical development workflow. The most common way to
activate them is by using the --production/-P CLI switch.

brunch build -P
brunch watch -P

On Saturday, May 17, 2014, Joseph Silvestre notifications@github.com
wrote:

Hello,

I'm running into a problem: I recently wanted to compress my JS files so I
installed the plugin. Apparently, it's not working for some reason (same
thing with brunch-clean-css). Could you please open my eyes on what I am
doing wrong, please?

Here is my package.json

{
"dependencies": {
"javascript-brunch": "1.7.1",
"css-brunch": "1.7.0",
"coffee-script-brunch": "1.8.0",
"stylus-brunch": "1.8.0",
"jade-brunch": "1.8.1",
"uglify-js-brunch": "1.7.7",
"clean-css-brunch": "1.7.1",
"coffeelint-brunch": "1.7.0"
}}

And my config.coffee:

module.exports.config =
files:
javascripts:
joinTo:
'javascripts/app.js': /^app/
'javascripts/vendor.js': /^vendor/
order:
# Files in vendor directories are compiled before other files
# even if they aren't specified in order.
before: [
'vendor/scripts/jquery-1.11.0.js'
'vendor/scripts/underscore-1.5.2.js'
'vendor/scripts/backbone-1.1.0.js'
'vendor/scripts/backbone.babysitter.js'
'vendor/scripts/backbone.projections.js'
]

    stylesheets:
        joinTo: 'stylesheets/app.css'
        order:
            before: ['vendor/styles/normalize.css']
            after: ['vendor/styles/helpers.css']

    templates:
        defaultExtension: 'jade'
        joinTo: 'javascripts/app.js'

plugins:
    uglify:
        mangle: false
        compress:
            global_defs:
                DEBUG: false
    cleancss:
        keepSpecialComments: 0
        removeEmpty: true

I think this could come from the fact I'm using Coffee to write JS and
Stylus to write CSS (for clean-css' case) but I didn't manage to 1°) be
100% sure it's the reason 2°) found a solution for that.

Thank you in advance!


Reply to this email directly or view it on GitHubhttps://github.com//issues/22
.

Thank you very much, I didn't know about it (nor found anything about it) ! This is now much faster :)

The command is now

brunch build -p
brunch watch -p

-P is for mapping ports