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']);
};