autofront 1.4.3 → 1.5.2
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 -1
- package/index.js +17 -5
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -20,7 +20,9 @@ Here is the essential basic organization you must to put in your project:
|
|
|
20
20
|
├─ src/
|
|
21
21
|
│ ├─ fonts/
|
|
22
22
|
│ ├─ styles/
|
|
23
|
-
│ │
|
|
23
|
+
│ │ ├─ _variables.scss
|
|
24
|
+
│ │ ├─ index.less
|
|
25
|
+
│ │ └─ index.scss
|
|
24
26
|
│ └─ index.html
|
|
25
27
|
├─ .gitignore
|
|
26
28
|
├─ bower.json
|
package/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const gulp = require('gulp'),
|
|
2
2
|
args = require('get-gulp-args')(),
|
|
3
|
+
mergeStream = require('merge-stream'),
|
|
3
4
|
mainBowerFiles = require('main-bower-files'),
|
|
4
5
|
$ = require('gulp-load-plugins')(),
|
|
5
6
|
injStr = $.injectString,
|
|
@@ -12,7 +13,8 @@ var domain = undefined;
|
|
|
12
13
|
const allFiles = getFiles(),
|
|
13
14
|
indexHtmlFile = 'index.html',
|
|
14
15
|
stylesFolder = 'styles/',
|
|
15
|
-
cssFilename =
|
|
16
|
+
cssFilename = 'index',
|
|
17
|
+
cssFullFilename = cssFilename+'.css',
|
|
16
18
|
jsTemplatesFile = 'scripts/templates.js';
|
|
17
19
|
|
|
18
20
|
const paths = {
|
|
@@ -21,9 +23,10 @@ const paths = {
|
|
|
21
23
|
dist: 'dist/'
|
|
22
24
|
};
|
|
23
25
|
paths.srcIndexHtml = paths.src+indexHtmlFile;
|
|
26
|
+
paths.srcSass = paths.src+getFiles('scss');
|
|
24
27
|
paths.srcLess = paths.src+getFiles('less');
|
|
25
28
|
paths.srcJs = paths.src+getFiles('js');
|
|
26
|
-
paths.srcOthers = [paths.src+allFiles, '!'+paths.srcIndexHtml, '!'+paths.srcLess, '!'+paths.srcJs];
|
|
29
|
+
paths.srcOthers = [paths.src+allFiles, '!'+paths.srcIndexHtml, '!'+paths.srcSass, '!'+paths.srcLess, '!'+paths.srcJs];
|
|
27
30
|
|
|
28
31
|
const nl = '\n',
|
|
29
32
|
tab = ' ';
|
|
@@ -43,13 +46,22 @@ gulp.task('check', () => {
|
|
|
43
46
|
});
|
|
44
47
|
|
|
45
48
|
gulp.task('del', () => delFolder(paths.tmp));
|
|
46
|
-
gulp.task('index-build', () => gulp.src(paths.srcIndexHtml).pipe(injStr.after('<!-- endbuild -->', nl+tab+'<link rel="stylesheet" href="'+
|
|
49
|
+
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)));
|
|
47
50
|
gulp.task('index-domain', () => gulp.src(paths.tmp+getFiles('js')).pipe(injStr.replace('{{AUTOFRONT_DOMAIN}}', domain)).pipe(gulp.dest(paths.tmp)));
|
|
48
51
|
gulp.task('index', gulpSync.sync([
|
|
49
52
|
'index-build',
|
|
50
53
|
'index-domain'
|
|
51
54
|
]));
|
|
52
|
-
gulp.task('styles', () =>
|
|
55
|
+
gulp.task('styles', () => {
|
|
56
|
+
return mergeStream(getCssStream('scss', $.sass, '@import "variables";'), getCssStream('less', $.less))
|
|
57
|
+
.pipe($.concat(cssFullFilename))
|
|
58
|
+
.pipe(gulp.dest(paths.tmp+stylesFolder));
|
|
59
|
+
|
|
60
|
+
function getCssStream(ext, process, extraCode) {
|
|
61
|
+
return gulp.src(paths.src+stylesFolder+cssFilename+'.'+ext).pipe(injStr.prepend((extraCode?extraCode+nl:'')+'// bower:'+ext+nl+'// endbower'+nl)).pipe($.wiredep()).pipe(process()).on('error', notifyError);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
53
65
|
gulp.task('fonts', () => gulp.src(mainBowerFiles()).pipe(filter(['eot','otf','svg','ttf','woff','woff2'], true)).pipe(gulp.dest(paths.tmp+'fonts/')));
|
|
54
66
|
gulp.task('others', () => {
|
|
55
67
|
const pugFilter = filter('pug');
|
|
@@ -66,7 +78,7 @@ gulp.task('build:tmp', gulpSync.sync([
|
|
|
66
78
|
gulp.task('browser', ['build:tmp'], () => browserSyncInit(paths.tmp));
|
|
67
79
|
gulp.task('serve', ['browser'], () => {
|
|
68
80
|
gulp.watch([paths.srcIndexHtml, paths.srcJs], ['index']);
|
|
69
|
-
gulp.watch(paths.srcLess, ['styles']);
|
|
81
|
+
gulp.watch([paths.srcSass, paths.srcLess], ['styles']);
|
|
70
82
|
gulp.watch(paths.srcOthers, ['others']);
|
|
71
83
|
gulp.watch(paths.tmp+allFiles, function(event) {
|
|
72
84
|
browserSync.reload(event.path);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autofront",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Gulp settings for projects.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"gulp-angular-templatecache": "^2.2.3",
|
|
30
30
|
"gulp-clean": "^0.4.0",
|
|
31
31
|
"gulp-clean-dest": "^0.2.0",
|
|
32
|
+
"gulp-concat": "^2.6.1",
|
|
32
33
|
"gulp-cssnano": "^2.1.3",
|
|
33
34
|
"gulp-filter": "^5.1.0",
|
|
34
35
|
"gulp-htmlmin": "^4.0.0",
|
|
@@ -44,11 +45,13 @@
|
|
|
44
45
|
"gulp-rev": "^8.1.1",
|
|
45
46
|
"gulp-rev-delete-original": "^0.2.3",
|
|
46
47
|
"gulp-rev-replace": "^0.4.4",
|
|
48
|
+
"gulp-sass": "^4.0.2",
|
|
47
49
|
"gulp-size": "^3.0.0",
|
|
48
50
|
"gulp-sync": "^0.1.4",
|
|
49
51
|
"gulp-terser": "^1.1.7",
|
|
50
52
|
"gulp-useref": "^3.1.6",
|
|
51
53
|
"gulp-wiredep": "^1.2.0",
|
|
52
|
-
"main-bower-files": "^2.13.1"
|
|
54
|
+
"main-bower-files": "^2.13.1",
|
|
55
|
+
"merge-stream": "^1.0.1"
|
|
53
56
|
}
|
|
54
57
|
}
|