autofront 1.4.2 → 1.5.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.
Files changed (3) hide show
  1. package/README.md +3 -2
  2. package/index.js +18 -6
  3. package/package.json +6 -3
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 `domainsAliases`).
11
+ Additionally, a parameter can be included (e.g.: `gulp --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
 
@@ -20,7 +20,8 @@ Here is the essential basic organization you must to put in your project:
20
20
  ├─ src/
21
21
  │ ├─ fonts/
22
22
  │ ├─ styles/
23
- │ │ └─ index.less
23
+ │ │ ├─ index.less
24
+ │ │ └─ index.scss
24
25
  │ └─ index.html
25
26
  ├─ .gitignore
26
27
  ├─ 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 = stylesFolder+'index',
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="'+cssFilename+'.css">')).pipe($.inject(gulp.src(paths.srcJs).pipe($.angularFilesort()), {relative: true})).on('error', notifyError).pipe($.wiredep()).pipe($.useref()).pipe(gulp.dest(paths.tmp)));
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', () => 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)));
55
+ gulp.task('styles', () => {
56
+ return mergeStream(getCssStream('scss', $.sass), getCssStream('less', $.less))
57
+ .pipe($.concat(cssFullFilename))
58
+ .pipe(gulp.dest(paths.tmp+stylesFolder));
59
+
60
+ function getCssStream(ext, process) {
61
+ return gulp.src(paths.src+stylesFolder+cssFilename+'.'+ext).pipe(injStr.prepend('// 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);
@@ -95,7 +107,7 @@ gulp.task('build', gulpSync.sync([
95
107
  return gulp.src(paths.dist+allFiles)
96
108
  .pipe(indexHtmlFilter).pipe(injStr.before('</body>', '<script src="'+jsTemplatesFile+'"></script>'+nl)).pipe(minifyHtml()).pipe(indexHtmlFilter.restore)
97
109
  .pipe(cssFilter).pipe($.cssnano({zindex: false})).pipe(cssFilter.restore)
98
- .pipe(jsFilter).pipe($.ngAnnotate()).pipe($.uglify()).pipe(jsFilter.restore)
110
+ .pipe(jsFilter).pipe($.ngAnnotate()).pipe($.terser()).pipe(jsFilter.restore)
99
111
  .pipe(cssAndJsFilter).pipe($.rev()).pipe($.revDeleteOriginal()).pipe(cssAndJsFilter.restore)
100
112
  .pipe($.revReplace())
101
113
  .pipe(imgFilter).pipe($.imagemin()).pipe(imgFilter.restore)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autofront",
3
- "version": "1.4.2",
3
+ "version": "1.5.1",
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
- "gulp-uglify": "^3.0.1",
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
  }