Browse Source

#2648 - Fix issue when build/watch tasks are imported without sub-tasks defined

pull/2095/merge
jlukic 9 years ago
parent
commit
021da85e3c
5 changed files with 49 additions and 4 deletions
  1. 6
      tasks/README.md
  2. 7
      tasks/build.js
  3. 19
      tasks/collections/build.js
  4. 16
      tasks/collections/rtl.js
  5. 5
      tasks/watch.js

6
tasks/README.md

@ -10,6 +10,8 @@
These tasks can be imported into your own gulpfile allowing you to avoid using Semantic's build tools
```javascript
var watch = require('path/to/semantic/tasks/watch');
gulp.task('watch ui', 'Watch Semantic UI', watch);
var
watch = require('path/to/semantic/tasks/watch')
;
gulp.task('watch ui', watch);
```

7
tasks/build.js

@ -8,9 +8,14 @@ var
// config
config = require('./config/user'),
install = require('./config/project/install')
;
// add sub-tasks
if(config.rtl) {
require('./collections/rtl')(gulp);
}
require('./collections/build')(gulp);
module.exports = function(callback) {
console.info('Building Semantic');

19
tasks/collections/build.js

@ -0,0 +1,19 @@
/*******************************
Define Sub-Tasks
*******************************/
module.exports = function(gulp) {
var
// build sub-tasks
buildJS = require('./../build/javascript'),
buildCSS = require('./../build/css'),
buildAssets = require('./../build/assets')
;
// in case these tasks are undefined during import, less make sure these are available in scope
gulp.task('build-javascript', 'Builds all javascript from source', buildJS);
gulp.task('build-css', 'Builds all css from source', buildCSS);
gulp.task('build-assets', 'Copies all assets from source', buildAssets);
};

16
tasks/collections/rtl.js

@ -0,0 +1,16 @@
/*******************************
Define Sub-Tasks
*******************************/
module.exports = function(gulp) {
var
// rtl
buildRTL = require('./../rtl/build'),
watchRTL = require('./../rtl/watch')
;
gulp.task('watch-rtl', 'Build all files as RTL', watchRTL);
gulp.task('build-rtl', 'Watch files as RTL ', buildRTL);
};

5
tasks/watch.js

@ -44,7 +44,10 @@ var
;
// add tasks that shouldn't be exposed to end-user
// add tasks referenced using gulp.run (sub-tasks)
if(config.rtl) {
require('./collections/rtl')(gulp);
}
require('./collections/internal')(gulp);

Loading…
Cancel
Save