Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grunt contrib coffee minify option

Is they anyway to generate directly minified js ? I don't want to use an other command such as grunt uglify because the sourcemaps won't point to the coffee but to the js

like image 627
edi9999 Avatar asked Oct 20 '22 15:10

edi9999


1 Answers

I get what you're saying about the sourcemaps, but you can still use uglify in a chain that gets you what you want. Uglify can have the final sourcemaps point to the original coffee files using its sourceMapIn option:

grunt.initConfig({
    coffee: {
        options: {
            sourceMap: true // causes creation of landing.js.map
        },
        files: { 'src/landing.js': 'src/landing.coffee' }
    },
    uglify: {
        options: {
            sourceMap: true,
            sourceMapIn: 'src/landing.js.map'
        },
        files: { 'src/landing.min.js': ['src/landing.js'] }
    }
});
like image 192
pettys Avatar answered Oct 27 '22 10:10

pettys