码迷,mamicode.com
首页 > 其他好文 > 详细

grunt + compass

时间:2015-04-17 17:36:38      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:

compass和sass文章列表:http://182.92.240.72/tag/compass/ 

compass实战grunt:

http://wrox.cn/article/2000491/ 

http://ju.outofmemory.cn/entry/73492

http://ju.outofmemory.cn/entry/75413

 

compass-demo/Gruntfile.js: https://github.com/minghe/compass-demo/blob/master/Gruntfile.js#L38

module.exports = function (grunt) {

    grunt.initConfig({
        // 指定打包目录
        buildBase: ‘build‘,
        //源码目录
        srcBase: ‘src‘,

        clean: {
            build: [
                ‘<%=buildBase %>‘
            ]
        },
        copy: {
            all: {
                files: [
                    {
                        expand: true,
                        cwd: ‘<%= srcBase %>‘,
                        src: [‘**/*.css‘],
                        dest: ‘<%=buildBase %>‘
                    }
                ]
            }

        },
        compass: {
            dist: {
                options: {
                    sassDir: ‘<%= srcBase %>‘,
                    specify: ‘<%= srcBase %>/index.sass‘,
                    cssDir : ‘<%= srcBase %>‘,
                    assetCacheBuster: false
                }
            },
            sprite: {
                options: {
                    sassDir: ‘<%= srcBase %>‘,
                    specify: ‘<%= srcBase %>/sprite.sass‘,
                    cssDir : ‘<%= srcBase %>‘,
                    imagesDir: "<%= srcBase %>/images",
                    httpPath:"http://www.36ria.com/css",
                    assetCacheBuster: false
                }
            },
            spriteX2: {
                options: {
                    sassDir: ‘<%= srcBase %>‘,
                    specify: ‘<%= srcBase %>/sprite-x2.sass‘,
                    cssDir : ‘<%= srcBase %>‘,
                    imagesDir: "<%= srcBase %>/images",
                    assetCacheBuster: false
                }
            }
        },
        cssmin: {
            build: {
                expand: true,
                cwd: ‘<%=buildBase %>‘,
                src: [‘**/*.css‘, ‘!**/*-min.css‘],
                dest: ‘<%=buildBase %>‘,
                ext: ‘-min.css‘
            }
        },
        watch: {
            options: {
                livereload: true
            },
            compass: {
                files: [‘<%= srcBase %>/**/*.sass‘],
                tasks: [‘compass‘]
            }
        }
    });
    /**
     * 载入使用到的通过NPM安装的模块
     */
    grunt.loadNpmTasks(‘grunt-contrib-clean‘);
    grunt.loadNpmTasks(‘grunt-contrib-copy‘);
    grunt.loadNpmTasks(‘grunt-contrib-cssmin‘);
    grunt.loadNpmTasks(‘grunt-contrib-watch‘);
    grunt.loadNpmTasks(‘grunt-contrib-compass‘);

    grunt.registerTask(‘default‘, [‘clean‘,‘compass‘,‘copy:all‘,‘cssmin:build‘]);
    grunt.registerTask(‘dev‘, [‘watch‘]);
    grunt.registerTask(‘sprite‘, [‘compass:spriteX2‘]);

};

  

grunt + compass

标签:

原文地址:http://www.cnblogs.com/ayseeing/p/4435296.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!