generator-kissy-pie
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -142,2 +142,3 @@ 'use strict'; | ||
this.mkdir('common'); | ||
this.copy('README.md', 'README.md'); | ||
this.template('abc.json'); | ||
@@ -144,0 +145,0 @@ this.template('package-config.js', 'common/package-config.js'); |
@@ -20,10 +20,12 @@ { | ||
"grunt-contrib-uglify": "~0.2.0", | ||
"grunt-contrib-clean": "~0.4.0",<% if(enableLess) { %> | ||
"grunt-contrib-less": "~0.5.0",<% } %><% if(enableCSSCombo) { %> | ||
"grunt-css-combo": "~0.1.3",<% } %><% if(enableSass) { %> | ||
"grunt-contrib-compass": "~0.1.3",<% } %> | ||
"grunt-contrib-clean": "~0.4.0"<% if(enableLess) { %>, | ||
"grunt-contrib-less": "~0.5.0"<% } %><% if(enableCSSCombo) { %>, | ||
"grunt-css-combo": "~0.1.3"<% } %><% if(enableSass) { %>, | ||
"grunt-contrib-compass": "~0.1.3"<% } %>, | ||
"grunt-contrib-cssmin": "~0.5.0", | ||
"grunt-contrib-watch": "~0.3.1", | ||
"grunt-kmc": "~0.1.0", | ||
"grunt-kissy-template": "~0.1.0" | ||
"grunt-contrib-connect": "~0.3.0", | ||
"grunt-kissy-template": "~0.1.0", | ||
"abc-gruntfile-helper": "~0.0.1" | ||
}, | ||
@@ -30,0 +32,0 @@ |
@@ -76,11 +76,11 @@ var KISSYPie = require( 'abc-gruntfile-helper').kissypie; | ||
name: '<%%= packageName %>', | ||
path: '<%%= pageBase %>' | ||
path: '<%%= pageName %>/<%%= version %>' | ||
}, | ||
{ | ||
name: 'utils', | ||
path: './utils' | ||
path: './' | ||
}, | ||
{ | ||
name: 'common', | ||
path: './common' | ||
path: './' | ||
} | ||
@@ -107,3 +107,4 @@ ] | ||
src: [ '*.js', '!*.combo.js', '!*-min.js' ], | ||
dest: '<%%= commonBase %>' | ||
dest: '<%%= commonBase %>', | ||
ext: '-min.js' | ||
} | ||
@@ -154,4 +155,36 @@ ] | ||
} | ||
}, | ||
}<% if(enableCSSCombo) { %>, | ||
/** | ||
* CSS-Combo | ||
*/ | ||
'css-combo': { | ||
options: { | ||
paths: ['.', '<%%= pageBase %>'] | ||
}, | ||
page: { | ||
files: [ | ||
{ | ||
expand: true, | ||
cwd: '<%%= pageBase %>', | ||
src: '*.less', | ||
dest: '<%%= pageBuildBase %>', | ||
ext: '.css' | ||
} | ||
] | ||
}, | ||
common: { | ||
files: [ | ||
{ | ||
expand: true, | ||
cwd: '<%%= commonBase %>', | ||
src: '*.less', | ||
dest: '<%%= commonBase %>', | ||
ext: '.css' | ||
} | ||
] | ||
} | ||
}<% } %><% if(enableLess) { %>, | ||
/** | ||
@@ -189,3 +222,3 @@ * 将LESS编译为CSS | ||
} | ||
}, | ||
}<% } %><% if(enableSass) { %>, | ||
@@ -219,3 +252,3 @@ /** | ||
} | ||
}, | ||
}<% } %>, | ||
@@ -228,3 +261,6 @@ /** | ||
options: { | ||
banner: '/*! <%%= pkg.name %> <%%= grunt.template.today("yyyy-mm-dd") %> */\n' | ||
banner: '/*! <%%= pkg.name %> <%%= grunt.template.today("yyyy-mm-dd") %> */\n', | ||
beautify: { | ||
ascii_only: true | ||
} | ||
}, | ||
@@ -246,7 +282,6 @@ page: { | ||
{ | ||
expand: 'true', | ||
expand: true, | ||
cwd: '<%%= commonBase %>', | ||
src: ['*.js', '!*-min.js'], | ||
dest: '<%%= commonBase %>', | ||
ext: '-min.js' | ||
src: ['*-min.js'], | ||
dest: '<%%= commonBase %>' | ||
} | ||
@@ -287,10 +322,2 @@ ] | ||
watch: { | ||
'less': { | ||
files: [ '<%%= pageBase %>/**/*.less', './utils/**/*.less' ], | ||
tasks: ['less', 'cssmin:page'] | ||
}, | ||
'compass': { | ||
files: [ '<%%= pageBase %>/**/*.scss', './utils/**/*.scss' ], | ||
tasks: ['compass', 'cssmin:page'] | ||
}, | ||
'js': { | ||
@@ -303,3 +330,11 @@ files: [ '<%%= pageBase %>/**/*.js', './utils/**/*.js' ], | ||
tasks: ['ktpl'] | ||
}, | ||
}<% if(enableLess) { %>, | ||
'less': { | ||
files: [ '<%%= pageBase %>/**/*.less', './utils/**/*.less' ], | ||
tasks: ['less', 'cssmin:page'] | ||
}<% } %><% if(enableSass) { %>, | ||
'compass': { | ||
files: [ '<%%= pageBase %>/**/*.scss', './utils/**/*.scss', '<%%= pageBase %>/**/*.png' ], | ||
tasks: ['compass', 'cssmin:page'] | ||
}<% } %>, | ||
'common': { | ||
@@ -327,6 +362,6 @@ // 排除一些任务的产出文件,避免死循环一直文件变更 | ||
grunt.loadNpmTasks('grunt-contrib-copy'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
grunt.loadNpmTasks('grunt-contrib-compass'); | ||
grunt.loadNpmTasks('grunt-css-combo'); | ||
grunt.loadNpmTasks('grunt-contrib-less'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify');<% if(enableCSSCombo) { %> | ||
grunt.loadNpmTasks('grunt-css-combo');<% } %> <% if(enableLess) { %> | ||
grunt.loadNpmTasks('grunt-contrib-less');<% } %> <% if(enableSass) { %> | ||
grunt.loadNpmTasks('grunt-contrib-compass');<% } %> | ||
grunt.loadNpmTasks('grunt-contrib-cssmin'); | ||
@@ -344,5 +379,5 @@ grunt.loadNpmTasks('grunt-contrib-watch'); | ||
// 对单个页面进行打包 | ||
grunt.registerTask('page', ['clean:page', 'ktpl:page','kmc:page', 'uglify:page', 'less:page', 'compass:page', 'cssmin:page']); | ||
grunt.registerTask('page', ['clean:page', 'ktpl:page','kmc:page', 'uglify:page'<% if(enableCSSCombo) { %>, 'css-combo:page'<% } %> <% if(enableLess) { %> ,'less:page'<% } %> <% if(enableSass) { %>, 'compass:page'<% } %>, 'cssmin:page']); | ||
// 对common进行打包 | ||
grunt.registerTask('common', ['ktpl:common', 'kmc:common', 'uglify:common', 'less:common', 'compass:common', 'cssmin:common']); | ||
grunt.registerTask('common', ['ktpl:common', 'kmc:common', 'uglify:common'<% if(enableCSSCombo) { %>, 'css-combo:page'<% } %><% if(enableLess) { %>, 'less:common'<% } %> <% if(enableSass) { %>, 'compass:common'<% } %>, 'cssmin:common']); | ||
@@ -349,0 +384,0 @@ grunt.registerTask('debug', ['page', 'debug-xxx']); |
{ | ||
"name": "generator-kissy-pie", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "kissy generator for kissypie", | ||
@@ -5,0 +5,0 @@ "main": "app/index.js", |
@@ -67,5 +67,4 @@ 'use strict'; | ||
this.template('fb.page.json', path.join(pagePath, 'fb.page.json')); | ||
//TODO choose based on styleEngine | ||
this.template('index.less', path.join(pagePath, 'page', 'index.less')); | ||
this.template('init.js', path.join(pagePath, 'page', 'init.js')); | ||
}; |
23836
20
605