编译&使用Grunt在deploybot上压缩SASS

时间:2015-10-01 19:15:14

标签: deployment web-deployment

我有一个笨拙的任务来编译&压缩我的JS& SASS文件在本地工作正常,但当我尝试在deploybot.com上使用它时,我只是得到一个错误说明:

sass sass/main.scss public/css/main.css --style=compressed --no-cache

这是我的咕噜文件:

module.exports = function(grunt){
grunt.initConfig({
    concat:{
        options:{
            stripBanners: true,
            sourceMap: true,
            sourceMapName: 'src/js/jsMap'
        },
        dist:{
            src: ['js/vendor/jquery.slicknav.js', 'js/vendor/swiper.js', 'js/app/*.js'],
            dest: 'src/js/main.js'
        },
    },
    copy:{
        js:{
            files:[
                { src: 'src/js/main.js', dest: 'public/js/main.js', },
                { src: 'src/js/jsMap', dest: 'public/js/jsMap', }
            ],
        },
    },
    uglify:{
        production:{
            options:{
                sourceMap: true,
                sourceMapIncludeSources: true,
                sourceMapIn: 'src/js/jsMap', // input sourcemap from a previous compilation
            },
            files: {
                'public/js/main.js': ['src/js/main.js'],
            },
        },
    },
    sass:{
        dev:{
            options:{
                style: 'expanded'
            },
            files:{
                'public/css/main.css': 'sass/main.scss'
            }
        },
        production:{
            options:{
                style: 'compressed',
                noCache: true
            },
            files:{
                'public/css/main.css': 'sass/main.scss'
            }
        }
    },
    watch: {
        dev:{
            files: ['js/**/*.js', 'sass/*.scss'],
            tasks: ['build-dev'],
            options: {
                spawn: false,
                interrupt: true,
            },
        },
    },
});

grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');

grunt.registerTask('build-dev', ['concat', 'copy:js', 'sass:dev']);
grunt.registerTask('build-prod', ['concat', 'uglify:production', 'sass:production']);

grunt.registerTask("watch-dev", ['watch:dev']);

};

这些是我正在运行以编译和运行的命令。压缩我的代码,所有版本特定的东西是尝试解决问题我有同样的问题删除它。

nvm install 0.10.25
nvm use 0.10.25
npm uninstall grunt -g
npm install grunt-cli -g
npm install grunt@0.4.5 --save-dev
npm install -g grunt-cli
npm install --save-dev
grunt build-prod --stack --verbose --debug

这是节点&节点之后的日志文件中显示的内容。 grunt安装位:

output Loading "Gruntfile.js" tasks...OK
output + build-dev, build-prod, watch-dev
output Running tasks: build-prod
output Running "build-prod" task
output [D] Task source: /source/Gruntfile.js
output Running "concat" task
output [D] Task source: /source/node_modules/grunt-contrib-concat/tasks/concat.js
output Running "concat:dist" (concat) task
output [D] Task source: /source/node_modules/grunt-contrib-concat/tasks/concat.js
output Verifying property concat.dist exists in config...OK
output Files: js/vendor/jquery.slicknav.js, js/vendor/swiper.js, js/app/centre-events-boxes.js, js/app/centre-footer.js, js/app/club.move-nav.js, js/app/club.social-link-position.js, js/app/func.stick-to-top.js, js/app/home.move-nav.js, js/app/home.stick-to-top.js, js/app/match-event-box-height.js, js/app/slicknav.js, js/app/swiperjs-slider.js -> src/js/main.js
output Options: separator="\n", banner="", footer="", stripBanners, process=false, sourceMap, sourceMapName="src/js/jsMap", sourceMapStyle="embed"
output Reading js/vendor/jquery.slicknav.js...OK
output Reading js/vendor/swiper.js...OK
output Reading js/app/centre-events-boxes.js...OK
output Reading js/app/centre-footer.js...OK
output Reading js/app/club.move-nav.js...OK
output Reading js/app/club.social-link-position.js...OK
output Reading js/app/func.stick-to-top.js...OK
output Reading js/app/home.move-nav.js...OK
output Reading js/app/home.stick-to-top.js...OK
output Reading js/app/match-event-box-height.js...OK
output Reading js/app/slicknav.js...OK
output Reading js/app/swiperjs-slider.js...OK
output Writing src/js/jsMap...OK
output Source map src/js/jsMap created.
output Writing src/js/main.js...OK
output File src/js/main.js created.
output Running "uglify:production" (uglify) task
output [D] Task source: /source/node_modules/grunt-contrib-uglify/tasks/uglify.js
output Verifying property uglify.production exists in config...OK
output Files: src/js/main.js -> public/js/main.js
output Options: banner="", footer="", compress={"warnings":false}, mangle={}, beautify=false, report="min", expression=false, maxLineLen=32000, ASCIIOnly=false, screwIE8=false, quoteStyle=0, sourceMap, sourceMapIncludeSources, sourceMapIn="src/js/jsMap"
output Minifying with UglifyJS...Reading src/js/jsMap...OK
output Parsing src/js/jsMap...OK
output Reading src/js/main.js...OK
output OK
output Writing public/js/main.js...OK
output Writing public/js/main.js.map...OK
output File public/js/main.js.map created (source map).
output File public/js/main.js created: 192.88 kB → 77.01 kB
output >> 1 sourcemap created.
output >> 1 file created.
output Running "sass:production" (sass) task
output [D] Task source: /source/node_modules/grunt-contrib-sass/tasks/sass.js
output Verifying property sass.production exists in config...OK
output Files: sass/main.scss -> public/css/main.css
output Options: style="compressed", noCache
output Command: sass sass/main.scss public/css/main.css --style=compressed --no-cache
output Errno::EISDIR: Is a directory @ rb_sysopen - public/css/main.css
output Use --trace for backtrace.
output Warning: Exited with error code 1 Use --force to continue.
output Aborted due to warnings.

我一直试图解决这个问题几天没有想法。我也试过联系他们的支持。

1 个答案:

答案 0 :(得分:0)

在多次联系他们的支持团队之后,问题就出现了,这与我认为的缓存机制有关。没有他们的支持我无法解决它。