Skip to content

Commit

Permalink
#2648 - Fix issue when build/watch tasks are imported without sub-tas…
Browse files Browse the repository at this point in the history
…ks defined
  • Loading branch information
jlukic committed Jul 16, 2015
1 parent d2c4547 commit 021da85
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 4 deletions.
6 changes: 4 additions & 2 deletions tasks/README.md
Expand Up @@ -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 changes: 6 additions & 1 deletion tasks/build.js
Expand Up @@ -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');
Expand Down
19 changes: 19 additions & 0 deletions 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 changes: 16 additions & 0 deletions 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 changes: 4 additions & 1 deletion tasks/watch.js
Expand Up @@ -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);


Expand Down

0 comments on commit 021da85

Please sign in to comment.