autofront 1.6.0 → 2.0.1
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 +3 -7
- package/index.js +19 -30
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
[Gulp](https://gulpjs.com) settings for front-end projects.
|
|
4
4
|
|
|
5
|
-
## Requirements
|
|
6
|
-
|
|
7
|
-
It is compatible with version [8.17.0](https://nodejs.org/dist/v8.17.0/) of [Node.js](https://nodejs.org).
|
|
8
|
-
|
|
9
5
|
## Behaviour
|
|
10
6
|
|
|
11
7
|
### Tasks
|
|
@@ -74,6 +70,6 @@ And, to capture the selected URL, put `{{AUTOFRONT_DOMAIN}}` where it would be l
|
|
|
74
70
|
|
|
75
71
|
## Pending
|
|
76
72
|
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
73
|
+
- Once the server waits for changes, synchronize also the deletion of files (from `src`).
|
|
74
|
+
- Sass errors must not break the Gulp process (like Less).
|
|
75
|
+
- Bower should be replaced as a dependency manager. It is currently [under maintenance](https://bower.io/blog/2017/how-to-migrate-away-from-bower/) and, therefore, its use is not recommended.
|
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@ const gulp = require('gulp'),
|
|
|
6
6
|
mainBowerFiles = require('main-bower-files'),
|
|
7
7
|
$ = require('gulp-load-plugins')(),
|
|
8
8
|
injStr = $.injectString,
|
|
9
|
-
|
|
9
|
+
gulpSass = $.sass(require('sass')),
|
|
10
10
|
notifyError = $.notify.onError(error => error.message),
|
|
11
11
|
browserSync = require('browser-sync').create();
|
|
12
12
|
|
|
@@ -50,12 +50,9 @@ gulp.task('check', () => {
|
|
|
50
50
|
gulp.task('del', () => delFolder(paths.tmp));
|
|
51
51
|
gulp.task('index-build', () => gulp.src(paths.srcIndexHtml).pipe(injStr.after('<!-- endbuild -->', nl+tab+'<link rel="stylesheet" href="'+stylesFolder+cssFullFilename+'">')).pipe($.inject(gulp.src(paths.srcJs).pipe($.angularFilesort()), {relative: true})).on('error', notifyError).pipe($.wiredep()).pipe($.useref()).pipe(gulp.dest(paths.tmp)));
|
|
52
52
|
gulp.task('index-domain', () => gulp.src(paths.tmp+getFiles('js')).pipe(injStr.replace('{{AUTOFRONT_DOMAIN}}', domain)).pipe(gulp.dest(paths.tmp)));
|
|
53
|
-
gulp.task('index',
|
|
54
|
-
'index-build',
|
|
55
|
-
'index-domain'
|
|
56
|
-
]));
|
|
53
|
+
gulp.task('index', gulp.series('index-build', 'index-domain'));
|
|
57
54
|
gulp.task('styles', () => {
|
|
58
|
-
return mergeStream(getCssStream('scss',
|
|
55
|
+
return mergeStream(getCssStream('scss', gulpSass, '@import "variables";'), getCssStream('less', $.less))
|
|
59
56
|
.pipe($.concat(cssFullFilename))
|
|
60
57
|
.pipe(gulp.dest(paths.tmp+stylesFolder));
|
|
61
58
|
|
|
@@ -71,34 +68,26 @@ gulp.task('others', () => {
|
|
|
71
68
|
.pipe(gulp.dest(paths.tmp));
|
|
72
69
|
});
|
|
73
70
|
gulp.task('about', () => gulp.src('package.json').pipe($.about()).pipe(gulp.dest(paths.tmp)));
|
|
74
|
-
gulp.task('build:tmp',
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
gulp.task('
|
|
80
|
-
gulp.
|
|
81
|
-
gulp.watch([paths.
|
|
82
|
-
gulp.watch(
|
|
83
|
-
gulp.watch(paths.srcOthers, ['others']);
|
|
71
|
+
gulp.task('build:tmp', gulp.series('del', 'check', gulp.parallel('index', 'styles', 'fonts', 'others', 'about')));
|
|
72
|
+
gulp.task('browser', gulp.series('build:tmp', (cb) => {
|
|
73
|
+
browserSyncInit(paths.tmp);
|
|
74
|
+
cb();
|
|
75
|
+
}));
|
|
76
|
+
gulp.task('serve', gulp.series('browser', () => {
|
|
77
|
+
gulp.watch([paths.srcIndexHtml, paths.srcJs], gulp.task('index'));
|
|
78
|
+
gulp.watch([paths.srcSass, paths.srcLess], gulp.task('styles'));
|
|
79
|
+
gulp.watch(paths.srcOthers, gulp.task('others'));
|
|
84
80
|
gulp.watch(paths.tmp+allFiles, function(event) {
|
|
85
81
|
browserSync.reload(event.path);
|
|
86
82
|
});
|
|
87
|
-
});
|
|
83
|
+
}));
|
|
88
84
|
|
|
89
85
|
gulp.task('del:dist', () => delFolder(paths.dist));
|
|
90
|
-
gulp.task('copy',
|
|
86
|
+
gulp.task('copy', gulp.series('del:dist', () => gulp.src(paths.tmp+allFiles).pipe(gulp.dest(paths.dist))));
|
|
91
87
|
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)));
|
|
92
88
|
gulp.task('templates-clean', () => require('delete-empty')(paths.dist));
|
|
93
|
-
gulp.task('templates',
|
|
94
|
-
|
|
95
|
-
'templates-clean'
|
|
96
|
-
]));
|
|
97
|
-
gulp.task('build', gulpSync.sync([
|
|
98
|
-
'build:tmp',
|
|
99
|
-
'copy',
|
|
100
|
-
'templates'
|
|
101
|
-
]), () => {
|
|
89
|
+
gulp.task('templates', gulp.series('templates-build', 'templates-clean'));
|
|
90
|
+
gulp.task('build', gulp.series('build:tmp', 'copy', 'templates', () => {
|
|
102
91
|
const indexHtmlFilter = filter('html'),
|
|
103
92
|
cssFilter = filter('css'),
|
|
104
93
|
jsFilter = filter('js'),
|
|
@@ -115,10 +104,10 @@ gulp.task('build', gulpSync.sync([
|
|
|
115
104
|
.pipe(jsonFilter).pipe($.jsonmin()).pipe(jsonFilter.restore)
|
|
116
105
|
.pipe($.size({showFiles: true}))
|
|
117
106
|
.pipe(gulp.dest(paths.dist));
|
|
118
|
-
});
|
|
119
|
-
gulp.task('serve:dist',
|
|
107
|
+
}));
|
|
108
|
+
gulp.task('serve:dist', gulp.series('build', () => browserSyncInit(paths.dist)));
|
|
120
109
|
|
|
121
|
-
gulp.task('default',
|
|
110
|
+
gulp.task('default', gulp.task('serve'));
|
|
122
111
|
|
|
123
112
|
function html5Mode() {
|
|
124
113
|
const pathPrefix = '/';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autofront",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Gulp settings for front-end projects.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"browser-sync": "^2.26.3",
|
|
29
29
|
"delete-empty": "^2.0.0",
|
|
30
30
|
"get-gulp-args": "0.0.1",
|
|
31
|
-
"gulp": "^
|
|
31
|
+
"gulp": "^4.0.2",
|
|
32
32
|
"gulp-about": "^1.1.0",
|
|
33
33
|
"gulp-angular-filesort": "^1.2.1",
|
|
34
34
|
"gulp-angular-templatecache": "^2.2.3",
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
"gulp-rev": "^8.1.1",
|
|
51
51
|
"gulp-rev-delete-original": "^0.2.3",
|
|
52
52
|
"gulp-rev-replace": "^0.4.4",
|
|
53
|
-
"gulp-sass": "^
|
|
53
|
+
"gulp-sass": "^5.0.0",
|
|
54
54
|
"gulp-size": "^3.0.0",
|
|
55
|
-
"gulp-sync": "^0.1.4",
|
|
56
55
|
"gulp-terser": "^1.1.7",
|
|
57
56
|
"gulp-useref": "^3.1.6",
|
|
58
57
|
"gulp-wiredep": "^1.2.0",
|
|
59
58
|
"main-bower-files": "^2.13.1",
|
|
60
|
-
"merge-stream": "^1.0.1"
|
|
59
|
+
"merge-stream": "^1.0.1",
|
|
60
|
+
"sass": "^1.38.2"
|
|
61
61
|
}
|
|
62
62
|
}
|