autofront 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.js +19 -10
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Gulp settings for projects.
|
|
|
8
8
|
- With `gulp serve:dist`, the server is production, but without the reload.
|
|
9
9
|
- `gulp build` builds the distributable version.
|
|
10
10
|
|
|
11
|
-
Additionally, a parameter can be included (e.g.: `gulp serve --dev` o `gulp build --pro`) to indicate the connection server. Defaults to local. And these domain URLs must to appear listed in `package.json` with the property `domains` (optionally also `
|
|
11
|
+
Additionally, a parameter can be included (e.g.: `gulp serve --dev` o `gulp build --pro`) to indicate the connection server. Defaults to local. And these domain URLs must to appear listed in `package.json` with the property `domains` (optionally also `domainsAliases`).
|
|
12
12
|
|
|
13
13
|
## Folder structure
|
|
14
14
|
|
package/index.js
CHANGED
|
@@ -4,8 +4,8 @@ const gulp = require('gulp'),
|
|
|
4
4
|
$ = require('gulp-load-plugins')(),
|
|
5
5
|
injStr = $.injectString,
|
|
6
6
|
gulpSync = $.sync(gulp),
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
notifyError = $.notify.onError(error => error.message),
|
|
8
|
+
browserSync = require('browser-sync').create();
|
|
9
9
|
|
|
10
10
|
var domain = undefined;
|
|
11
11
|
|
|
@@ -30,10 +30,10 @@ const nl = '\n',
|
|
|
30
30
|
|
|
31
31
|
gulp.task('check', () => {
|
|
32
32
|
const pckg = require('./package.json'),
|
|
33
|
-
|
|
33
|
+
domainAliases = pckg.domainAliases;
|
|
34
34
|
var domainIndex = args[0]||'local';
|
|
35
|
-
if (
|
|
36
|
-
const alias =
|
|
35
|
+
if (domainAliases) {
|
|
36
|
+
const alias = domainAliases[domainIndex];
|
|
37
37
|
if (alias)
|
|
38
38
|
domainIndex = alias;
|
|
39
39
|
}
|
|
@@ -49,9 +49,14 @@ gulp.task('index', gulpSync.sync([
|
|
|
49
49
|
'index-build',
|
|
50
50
|
'index-domain'
|
|
51
51
|
]));
|
|
52
|
-
gulp.task('styles', () => gulp.src(paths.src+cssFilename+'.less').pipe(injStr.prepend('// bower:less'+nl+'// endbower'+nl)).pipe($.wiredep()).pipe($.less()).on('error',
|
|
52
|
+
gulp.task('styles', () => gulp.src(paths.src+cssFilename+'.less').pipe(injStr.prepend('// bower:less'+nl+'// endbower'+nl)).pipe($.wiredep()).pipe($.less()).on('error', notifyError).pipe(gulp.dest(paths.tmp+stylesFolder)));
|
|
53
53
|
gulp.task('fonts', () => gulp.src(mainBowerFiles()).pipe(filter(['eot','otf','svg','ttf', 'woff', 'woff2'], true)).pipe(gulp.dest(paths.tmp+'fonts/')));
|
|
54
|
-
gulp.task('others', () =>
|
|
54
|
+
gulp.task('others', () => {
|
|
55
|
+
const pugFilter = filter('pug');
|
|
56
|
+
return gulp.src(paths.srcOthers)
|
|
57
|
+
.pipe(pugFilter).pipe($.pug()).on('error', notifyError).pipe(pugFilter.restore)
|
|
58
|
+
.pipe(gulp.dest(paths.tmp));
|
|
59
|
+
});
|
|
55
60
|
gulp.task('about', () => gulp.src('package.json').pipe($.about()).pipe(gulp.dest(paths.tmp)));
|
|
56
61
|
gulp.task('build:tmp', gulpSync.sync([
|
|
57
62
|
'del',
|
|
@@ -70,8 +75,8 @@ gulp.task('serve', ['browser'], () => {
|
|
|
70
75
|
|
|
71
76
|
gulp.task('del:dist', () => delFolder(paths.dist));
|
|
72
77
|
gulp.task('copy', ['del:dist'], () => gulp.src(paths.tmp+allFiles).pipe(gulp.dest(paths.dist)));
|
|
73
|
-
gulp.task('templates-build', () => gulp.src([paths.dist+getFiles('html'), '!'+paths.dist+indexHtmlFile]).pipe($.cleanDest(paths.dist)).pipe(
|
|
74
|
-
gulp.task('templates-clean', () =>
|
|
78
|
+
gulp.task('templates-build', () => gulp.src([paths.dist+getFiles('html'), '!'+paths.dist+indexHtmlFile]).pipe($.cleanDest(paths.dist)).pipe(minifyHtml()).pipe($.angularTemplatecache(jsTemplatesFile, {module: 'app'})).pipe(gulp.dest(paths.dist)));
|
|
79
|
+
gulp.task('templates-clean', () => require('delete-empty')(paths.dist));
|
|
75
80
|
gulp.task('templates', gulpSync.sync([
|
|
76
81
|
'templates-build',
|
|
77
82
|
'templates-clean'
|
|
@@ -88,7 +93,7 @@ gulp.task('build', gulpSync.sync([
|
|
|
88
93
|
imgFilter = filter(['png','jpg','gif','svg']),
|
|
89
94
|
jsonFilter = filter('json');
|
|
90
95
|
return gulp.src(paths.dist+allFiles)
|
|
91
|
-
.pipe(indexHtmlFilter).pipe(injStr.before('</body>', '<script src="'+jsTemplatesFile+'"></script>'+nl)).pipe(
|
|
96
|
+
.pipe(indexHtmlFilter).pipe(injStr.before('</body>', '<script src="'+jsTemplatesFile+'"></script>'+nl)).pipe(minifyHtml()).pipe(indexHtmlFilter.restore)
|
|
92
97
|
.pipe(cssFilter).pipe($.cssnano({zindex: false})).pipe(cssFilter.restore)
|
|
93
98
|
.pipe(jsFilter).pipe($.ngAnnotate()).pipe($.uglify()).pipe(jsFilter.restore)
|
|
94
99
|
.pipe(cssAndJsFilter).pipe($.rev()).pipe($.revDeleteOriginal()).pipe(cssAndJsFilter.restore)
|
|
@@ -123,4 +128,8 @@ function browserSyncInit(path) {
|
|
|
123
128
|
baseDir: path
|
|
124
129
|
}
|
|
125
130
|
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function minifyHtml() {
|
|
134
|
+
return $.htmlmin({collapseWhitespace: true, conservativeCollapse: true});
|
|
126
135
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autofront",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Gulp settings for projects.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"gulp-load-plugins": "^1.5.0",
|
|
39
39
|
"gulp-ng-annotate": "^2.1.0",
|
|
40
40
|
"gulp-notify": "^3.2.0",
|
|
41
|
+
"gulp-pug": "^4.0.1",
|
|
41
42
|
"gulp-rev": "^8.1.1",
|
|
42
43
|
"gulp-rev-delete-original": "^0.2.3",
|
|
43
44
|
"gulp-rev-replace": "^0.4.4",
|