Created
July 13, 2017 02:19
-
-
Save pizzapanther/141e2ad9bac538015bd9281df9ef3e8c to your computer and use it in GitHub Desktop.
Gulp Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var gulp = require('gulp'); | |
| var plumber = require('gulp-plumber'); | |
| var concat = require("gulp-concat"); | |
| var less = require('gulp-less'); | |
| var rollup = require('rollup').rollup; | |
| var buble = require('rollup-plugin-buble'); | |
| var resolve = require('rollup-plugin-node-resolve'); | |
| var commonjs = require('rollup-plugin-commonjs'); | |
| var build_tasks = ['build-js', 'build-css']; | |
| gulp.task('build-js', function () { | |
| return rollup({ | |
| entry: './static/nac/nac.js', | |
| plugins: [ | |
| resolve({ jsnext: true }), | |
| commonjs(), | |
| buble() | |
| ], | |
| external: ['vue', 'vue-router', 'vue-material'] | |
| }).then(function (bundle) { | |
| return bundle.write({ | |
| format: 'iife', | |
| dest: './static/dist/nac.js', | |
| globals: { | |
| "vue": 'Vue', | |
| "vue-router": 'VueRouter', | |
| "vue-material": 'VueMaterial', | |
| }, | |
| }); | |
| }); | |
| }); | |
| gulp.task('build-css', function () { | |
| return gulp.src("static/nac/**/*.less") | |
| .pipe(plumber()) | |
| .pipe(less({paths: ['static/less']})) | |
| .pipe(concat('nac.css')) | |
| .pipe(gulp.dest("static/dist")); | |
| }); | |
| gulp.task('watch', build_tasks, function () { | |
| gulp.watch("static/nac/**/*.js", ['build-js']); | |
| gulp.watch("static/**/*.less", ['build-css']); | |
| }); | |
| gulp.task('default', build_tasks); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment