-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
38 lines (30 loc) · 1.19 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var gulp = require("gulp");
//For postcss
var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer');
var partialImport = require('postcss-partial-import')({ /* options */ });
var precss = require('precss'); //use Sass-like markup in your CSS files
var sourcemaps = require('gulp-sourcemaps');
var ts = require("gulp-typescript");
var tsProject = ts.createProject("tsconfig.json");
console.log('tsProject', tsProject.options.outDir);
gulp.task("scripts", function () {
return tsProject.src()
.pipe(ts(tsProject))
.js.pipe(gulp.dest("./"+tsProject.options.outDir));
});
gulp.task('css', function () {
return gulp.src([
'!./app/Resources/assets/styles/modules/',
'./app/Resources/assets/styles/*.css'
])
.pipe( sourcemaps.init() )
.pipe( postcss([ partialImport, autoprefixer, precss ]) )
.pipe( sourcemaps.write('.') )
.pipe( gulp.dest('./app/assets/css/') );
});
gulp.task('watch', function () {
gulp.watch('./app/Resources/css/**/*.css', ['css']);
gulp.watch('./app/Resources/scripts/**/*.ts', ['scripts']);
});
gulp.task('default', ['scripts', 'css', 'watch']);