Skip to content

Commit

Permalink
添加--buildTo参数来指定打包目录
Browse files Browse the repository at this point in the history
  • Loading branch information
yinruo.nyj committed Dec 7, 2013
1 parent 9e3cb2d commit 50d9dfc
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,6 @@
## v0.4.2
- 添加打包的 `--buildTo` 参数,指定打包到的路径(默认是`build`)

## v0.4.1
- 添加对stylus的支持
- 添加总体打包时间,单个任务打包时间的log
Expand Down
10 changes: 9 additions & 1 deletion README.md
Expand Up @@ -63,5 +63,13 @@ $ yo kissy-cake:page

## 查看版本信息以及命令列表

- `yo kissy-cake:help`
- `yo kissy-cake:help`

## 指定打包目录

KISSY-Cake默认将所有文件从`src`打包到`build`,你也可以指定需要打包到的目录:

```
grunt --buildTo myBuild
```

27 changes: 18 additions & 9 deletions app/templates/Gruntfile.js
Expand Up @@ -25,7 +25,7 @@ module.exports = function (grunt) {

pkg: grunt.file.readJSON('package.json'),
repoVersion: ABCConfig.version,
buildBase: 'build',
buildBase: grunt.option( 'buildTo' ) || 'build',
srcBase: 'src',
// 包名
packageName: 'page',
Expand Down Expand Up @@ -93,7 +93,8 @@ module.exports = function (grunt) {
page: ABCConfig._kissy_cake.defaults.pages
},
config: {
pageName: '<%%= page %>'
buildBase: grunt.option( 'buildTo' ) || 'build',
pageName: '<%= page %>'
},
tasks: [ '_page' ]
}
Expand All @@ -111,7 +112,8 @@ module.exports = function (grunt) {
widget: ABCConfig._kissy_cake.defaults.widgets
},
config: {
widgetName: '<%%= widget %>'
buildBase: grunt.option( 'buildTo' ) || 'build',
widgetName: '<%= widget %>'
},
tasks: [ '_widget' ]
}
Expand All @@ -129,7 +131,8 @@ module.exports = function (grunt) {
page: { patterns: '*', options: { cwd: 'src/pages', filter: 'isDirectory' } }
},
config: {
pageName: '<%%= page %>'
buildBase: grunt.option( 'buildTo' ) || 'build',
pageName: '<%= page %>'
},
tasks: [ '_page' ]
}
Expand All @@ -147,7 +150,8 @@ module.exports = function (grunt) {
widget: { patterns: '*', options: { cwd: 'src/widget', filter: 'isDirectory' } }
},
config: {
widgetName: '<%%= widget %>'
buildBase: grunt.option( 'buildTo' ) || 'build',
widgetName: '<%= widget %>'
},
tasks: [ '_widget' ]
}
Expand All @@ -160,7 +164,8 @@ module.exports = function (grunt) {
page: ABCConfig._kissy_cake.defaults.pages
},
config: {
pageName: '<%%= page %>',
pageName: '<%= page %>',
buildBase: grunt.option( 'buildTo' ) || 'build',
watch: function( vars, rawConfig ){
var rawWatch = grunt.util._.clone( rawConfig.watch );
grunt.util._.each( rawWatch, function( value , key ){
Expand All @@ -182,7 +187,8 @@ module.exports = function (grunt) {
widget: ABCConfig._kissy_cake.defaults.widgets
},
config: {
widgetName: '<%%= widget %>',
widgetName: '<%= widget %>',
buildBase: grunt.option( 'buildTo' ) || 'build',
watch: function( vars, rawConfig ){
var rawWatch = grunt.util._.clone( rawConfig.watch );
grunt.util._.each( rawWatch, function( value , key ){
Expand All @@ -201,6 +207,7 @@ module.exports = function (grunt) {
options: {
continued: true,
config: {
buildBase: grunt.option( 'buildTo' ) || 'build',
watch: function( vars, rawConfig ){
var rawWatch = grunt.util._.clone( rawConfig.watch );
grunt.util._.each( rawWatch, function( value , key ){
Expand All @@ -222,7 +229,8 @@ module.exports = function (grunt) {
page: { patterns: '*', options: { cwd: 'src/pages', filter: 'isDirectory' } }
},
config: {
pageName: '<%%= page %>',
pageName: '<%= page %>',
buildBase: grunt.option( 'buildTo' ) || 'build',
watch: function( vars, rawConfig ){
var rawWatch = grunt.util._.clone( rawConfig.watch );
grunt.util._.each( rawWatch, function( value , key ){
Expand All @@ -244,7 +252,8 @@ module.exports = function (grunt) {
widget: { patterns: '*', options: { cwd: 'src/widget', filter: 'isDirectory' } }
},
config: {
widgetName: '<%%= widget %>',
widgetName: '<%= widget %>',
buildBase: grunt.option( 'buildTo' ) || 'build',
watch: function( vars, rawConfig ){
var rawWatch = grunt.util._.clone( rawConfig.watch );
grunt.util._.each( rawWatch, function( value , key ){
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "generator-kissy-cake",
"version": "0.4.1",
"version": "0.4.2",
"description": "Yeoman Generator for KISSY-Cake",
"main": "index.js",
"author": "abc-team",
Expand Down

0 comments on commit 50d9dfc

Please sign in to comment.