Fork me on GitHub

切个图,想用 babel&sass

前面有 切个图,想用 sass [切个图,想用-babel]/2018/12/26/切个图,想用-babel/

最终还是用了 gulp

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
{
"name": "model",
"version": "1.0.0",
"description": "new project package.json model",
"scripts": {

},
"author": "frostbelt",
"license": "ISC",
"devDependencies": {
"babel-cli": "^6.16.0",
"babel-core": "^6.26.3",
"babel-loader": "^6.2.5",
"babel-plugin-lodash": "^3.2.9",
"babel-polyfill": "^6.16.0",
"babel-preset-env": "^1.7.0",
"babel-preset-es2015": "^6.16.0",
"babel-preset-stage-0": "^6.24.1",
"gulp": "^3.9.1",
"gulp-babel": "^7.0.1",
"gulp-clean": "^0.3.2",
"gulp-sass": "^4.0.2",
"gulp-uglify": "^3.0.0",
"node-sass": "^4.11.0"
}
}

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
39
/**
* new project gulpfile.js model
*/

const gulp = require('gulp');
const uglify = require("gulp-uglify");
const babel = require("gulp-babel");
const sass = require('gulp-sass');

/**
* js
*/
gulp.task("js", function(){
return gulp.src("resources/assets/js/**/*.js")
.pipe(babel({
presets : [
"env",
],
}))
.pipe(uglify())
.pipe(gulp.dest("public/dist/js"));
});
gulp.task("watchjs", function(){
gulp.watch("resources/assets/js/**/*.js", ['js']);
});

/**
* css
*/
gulp.task("css", function(){
return gulp.src("resources/assets/css/**/*.scss")
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(gulp.dest("public/dist/css"));
});
gulp.task("watchcss", function(){
gulp.watch("resources/assets/css/**/*.scss", ['css']);
});

gulp.task("default", ["watchjs", "watchcss"]);
-------------感谢您的阅读 有问题请留言(或mailto:frostbelt@sina.cn)-------------