autofront 1.0.0 → 1.1.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.
Files changed (3) hide show
  1. package/README.md +2 -0
  2. package/index.js +24 -1
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -8,6 +8,8 @@ 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 `domainsAlias`).
12
+
11
13
  ## Folder structure
12
14
 
13
15
  Here is the essential basic organization you must to put in your project:
package/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const gulp = require('gulp'),
2
+ args = require('get-gulp-args')(),
2
3
  mainBowerFiles = require('main-bower-files'),
3
4
  $ = require('gulp-load-plugins')(),
4
5
  injStr = $.injectString,
@@ -6,6 +7,8 @@ const gulp = require('gulp'),
6
7
  browserSync = require('browser-sync').create(),
7
8
  deleteEmpty = require('delete-empty');
8
9
 
10
+ var domain = undefined;
11
+
9
12
  const allFiles = getFiles(),
10
13
  indexHtmlFile = 'index.html',
11
14
  stylesFolder = 'styles/',
@@ -25,14 +28,34 @@ paths.srcOthers = [paths.src+allFiles, '!'+paths.srcIndexHtml, '!'+paths.srcLess
25
28
  const nl = '\n',
26
29
  tab = ' ';
27
30
 
31
+ gulp.task('check', () => {
32
+ const pckg = require('./package.json'),
33
+ domainAlias = pckg.domainAlias;
34
+ var domainIndex = args[0]||'local';
35
+ if (domainAlias) {
36
+ const alias = domainAlias[domainIndex];
37
+ if (alias)
38
+ domainIndex = alias;
39
+ }
40
+ domain = pckg.domains[domainIndex];
41
+ return gulp.src(paths.src)
42
+ .pipe(domain?$.notify('Matching domain: "'+domainIndex+'".'):process.exit());
43
+ });
44
+
28
45
  gulp.task('del', () => delFolder(paths.tmp));
29
- gulp.task('index', () => gulp.src(paths.srcIndexHtml).pipe(injStr.after('<!-- endbuild -->', nl+tab+'<link rel="stylesheet" href="'+cssFilename+'.css">')).pipe($.wiredep()).pipe($.useref()).pipe(gulp.dest(paths.tmp)));
46
+ gulp.task('index-build', () => gulp.src(paths.srcIndexHtml).pipe(injStr.after('<!-- endbuild -->', nl+tab+'<link rel="stylesheet" href="'+cssFilename+'.css">')).pipe($.wiredep()).pipe($.useref()).pipe(gulp.dest(paths.tmp)));
47
+ gulp.task('index-domain', () => gulp.src(paths.tmp+getFiles('js')).pipe(injStr.replace('{{AUTOFRONT_DOMAIN}}', domain)).pipe(gulp.dest(paths.tmp)));
48
+ gulp.task('index', gulpSync.sync([
49
+ 'index-build',
50
+ 'index-domain'
51
+ ]));
30
52
  gulp.task('styles', () => gulp.src(paths.src+cssFilename+'.less').pipe(injStr.prepend('// bower:less'+nl+'// endbower'+nl)).pipe($.wiredep()).pipe($.less()).on('error', $.notify.onError(error => error.message)).pipe(gulp.dest(paths.tmp+stylesFolder)));
31
53
  gulp.task('fonts', () => gulp.src(mainBowerFiles()).pipe(filter(['eot','otf','svg','ttf', 'woff', 'woff2'], true)).pipe(gulp.dest(paths.tmp+'fonts/')));
32
54
  gulp.task('others', () => gulp.src(paths.srcOthers).pipe(gulp.dest(paths.tmp)));
33
55
  gulp.task('about', () => gulp.src('package.json').pipe($.about()).pipe(gulp.dest(paths.tmp)));
34
56
  gulp.task('build:tmp', gulpSync.sync([
35
57
  'del',
58
+ 'check',
36
59
  ['index', 'styles', 'fonts', 'others', 'about']
37
60
  ]));
38
61
  gulp.task('browser', ['build:tmp'], () => browserSyncInit(paths.tmp));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autofront",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Gulp settings for projects.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,6 +22,7 @@
22
22
  "dependencies": {
23
23
  "browser-sync": "^2.24.4",
24
24
  "delete-empty": "^2.0.0",
25
+ "get-gulp-args": "0.0.1",
25
26
  "gulp": "^3.9.1",
26
27
  "gulp-about": "^1.1.0",
27
28
  "gulp-angular-templatecache": "^2.2.1",