gulpfile.js
changeset 0 f05d7aea098a
child 11 b6023e43122d
equal deleted inserted replaced
-1:000000000000 0:f05d7aea098a
       
     1 
       
     2 const { src, dest, task, watch, parallel } = require('gulp');
       
     3 const concat = require('gulp-concat');
       
     4 const less = require('gulp-less');
       
     5 
       
     6 const
       
     7 	package = require('./package.json'),
       
     8 	paths = package.paths;
       
     9 
       
    10 
       
    11 task('css', function() {
       
    12 	return src(paths.less_main, { cwd: paths.less_base })
       
    13 		.pipe(less())
       
    14 		.pipe(dest(paths.less_target));
       
    15 });
       
    16 
       
    17 
       
    18 task('scripts', function() {
       
    19 	return src(paths.sources, { cwd: paths.base })
       
    20 		.pipe(concat(paths.target.replace(/{version}/, package.version)))
       
    21 		.pipe(dest(paths.base));
       
    22 });
       
    23 
       
    24 
       
    25 task('scripts_core', function() {
       
    26 	return src(paths.core_sources, { cwd: paths.base })
       
    27 		.pipe(concat(paths.core_target.replace(/{version}/, package.version)))
       
    28 		.pipe(dest(paths.base));
       
    29 });
       
    30 
       
    31 
       
    32 exports.default = function() {
       
    33 	watch(paths.sources, { cwd: paths.base }, parallel('scripts', 'scripts_core'));
       
    34 	watch(paths.less_sources, { cwd: paths.less_base}, parallel('css'));
       
    35 };