2

実行するgruntと、端末にこの出力が表示されます。

"concat:dist" (concat) タスクの実行
ファイル ../web/js/main.js が作成されました。

「uglify:dist」(uglify) タスクの実行

"compass:dist" (コンパス) タスクの実行
変更されていない master.scss
コンパイルにかかった時間は 0.093 秒

"autoprefixer:dist" (autoprefixer) タスクの実行

エラーなしで完了。

uglify と autoprefixer は出力を表示しません

しかし、私が実行するとgrunt -v

Running "concat" task

Running "concat:dist" (concat) task
Verifying property concat.dist exists in config...OK
Files: lot of files, ../js/eug/eug-main.js -> ../web/js/main.js
Options: separator=";", banner="", footer="", stripBanners=false, process=false, sourceMap=false, sourceMapName=undefined, sourceMapStyle="embed"
Reading ../js/vendor/eug-jquery-1.11.1.js...OK
Reading ..more files.......OK
Writing ../web/js/main.js...OK
File ../web/js/main.js created.

Running "uglify" task

Running "uglify:dist" (uglify) task
Verifying property uglify.dist exists in config...OK
Files: ../web/js/main.js -> ../web/js/main.min.js
Options: banner="", footer="", compress={"warnings":false}, mangle={}, beautify=false, report="gzip", expression=false
Minifying with UglifyJS...Reading ../web/js/main.js...OK
OK
Writing ../web/js/main.min.js...OK
File ../web/js/main.min.js created: 735.15 kB → 222.43 kB → 69.05 kB (gzip)

Running "compass" task

Running "compass:dist" (compass) task
Verifying property compass.dist exists in config...OK
File: [no files]
Options: sassDir="dirs", outputStyle="compressed", noLineComments=false, cacheDir="../sass/.sass-cache/"
unchanged master.scss
Compilation took 0.084s

Running "autoprefixer" task

Running "autoprefixer:dist" (autoprefixer) task
Verifying property autoprefixer.dist exists in config...OK
Options: cascade, diff=false, map=false, browsers=["Android 2.3","Android >= 4","Chrome >= 20","Firefox >= 24","Explorer >= 8","iOS >= 6","Opera >= 12","Safari >= 6"]

Done, without errors.

uglify は動作し、ファイル出力を書き込み、ファイル レポートを表示します。

-v がないと機能しないのはなぜですか? 以前はターミナルに表示されていたのを覚えています。

ここに私のGruntfile.jsがあります

module.exports = function(grunt) {

    // init config
    grunt.initConfig({
        // read package.json
        pkg: grunt.file.readJSON('package.json'),
        concat: {
            options: {
                separator: ';'
            },
            dist: {
                src: [
                    '../js/vendor/eug-jquery-1.11.1.js',
                    '..more files..'
                    '../js/eug/*.js'
                ],
                dest: '../web/js/main.js' // merged file
            }
        },
        uglify: {
            options: {
                banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %> */\n',
                report: 'gzip'
            },
            dist: {
                files: {
                    '../web/js/main.min.js': ['<%= concat.dist.dest %>'] // output file.
                }
            }
        },
        compass: {
            dist: {
                options: {
                    sassDir: '../sass/scss/',
                    cssDir: '../web/css/',
                    imagesDir: '../web/images/',
                    outputStyle: 'compressed', // nested / expanded / compact / compressed
                    noLineComments: false,
                    cacheDir: '../sass/.sass-cache/'
                }
            }
        },
        autoprefixer: {
            dist: {
                options: {
                    browsers: ['Android 2.3','Android >= 4','Chrome >= 20','Firefox >= 24','Explorer >= 8','iOS >= 6','Opera >= 12','Safari >= 6']
                },
                files: [{
                    expand: true,
                    cwd: './web/css/',
                    src: '{,*/}*.css',
                    dest: './web/css/'
                }]
            }
        },
        watch: {
            compass: {
                files: ['../sass/scss/**/*.scss'],
                tasks: ['compass'], // on change execute
                options: {
                    spawn: false,
                },
            },
            scripts: {
                files: ['../js/**/*.js'],
                tasks: ['concat'], // on change execute
                options: {
                    spawn: false,
                },
            }
        },
    });

    // load tasks
    grunt.loadNpmTasks('grunt-contrib-watch');      // file watcher
    grunt.loadNpmTasks('grunt-contrib-concat');     // concat js files
    grunt.loadNpmTasks('grunt-contrib-uglify');     // minify js files
    grunt.loadNpmTasks('grunt-contrib-compass');    // compass compiler
    grunt.loadNpmTasks('grunt-autoprefixer');       // autoprefixer css

    // register tasks
    grunt.registerTask('test', []);
    grunt.registerTask('default', []);
    grunt.registerTask('listen', ['watch']);
    grunt.registerTask('prod-init', ['concat', 'uglify', 'compass', 'autoprefixer']);
};
4

0 に答える 0