feat: new Web UI build system
- use generator-gulp-angular by @swiip - remove old static file
This commit is contained in:
parent
587b17c120
commit
b7a71edfcb
83 changed files with 1069 additions and 1028 deletions
54
webui/gulp/styles.js
Normal file
54
webui/gulp/styles.js
Normal file
|
@ -0,0 +1,54 @@
|
|||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var gulp = require('gulp');
|
||||
var conf = require('./conf');
|
||||
|
||||
var browserSync = require('browser-sync');
|
||||
|
||||
var $ = require('gulp-load-plugins')();
|
||||
|
||||
var wiredep = require('wiredep').stream;
|
||||
var _ = require('lodash');
|
||||
|
||||
gulp.task('styles-reload', ['styles'], function() {
|
||||
return buildStyles()
|
||||
.pipe(browserSync.stream());
|
||||
});
|
||||
|
||||
gulp.task('styles', function() {
|
||||
return buildStyles();
|
||||
});
|
||||
|
||||
var buildStyles = function() {
|
||||
var sassOptions = {
|
||||
style: 'expanded'
|
||||
};
|
||||
|
||||
var injectFiles = gulp.src([
|
||||
path.join(conf.paths.src, '/app/**/*.scss'),
|
||||
path.join('!' + conf.paths.src, '/app/index.scss')
|
||||
], { read: false });
|
||||
|
||||
var injectOptions = {
|
||||
transform: function(filePath) {
|
||||
filePath = filePath.replace(conf.paths.src + '/app/', '');
|
||||
return '@import "' + filePath + '";';
|
||||
},
|
||||
starttag: '// injector',
|
||||
endtag: '// endinjector',
|
||||
addRootSlash: false
|
||||
};
|
||||
|
||||
|
||||
return gulp.src([
|
||||
path.join(conf.paths.src, '/app/index.scss')
|
||||
])
|
||||
.pipe($.inject(injectFiles, injectOptions))
|
||||
.pipe(wiredep(_.extend({}, conf.wiredep)))
|
||||
.pipe($.sourcemaps.init())
|
||||
.pipe($.sass(sassOptions)).on('error', conf.errorHandler('Sass'))
|
||||
.pipe($.autoprefixer()).on('error', conf.errorHandler('Autoprefixer'))
|
||||
.pipe($.sourcemaps.write())
|
||||
.pipe(gulp.dest(path.join(conf.paths.tmp, '/serve/app/')));
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue