Skip to content

Commit dd31384

Browse files
author
Marco Solazzi
committed
Merge branch 'release/4.1.0'
2 parents 229e9e2 + 767a4de commit dd31384

File tree

5 files changed

+26
-16
lines changed

5 files changed

+26
-16
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wok",
3-
"version": "4.0.3",
3+
"version": "4.1.0",
44
"authors": [
55
"Marco Solazzi <[email protected]>",
66
"Matteo Guidotto <[email protected]>",

build/gulp-config/paths.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22

33
const srcRoot = 'application';
44
const distRoot = 'public';
5+
const assetsPath = 'assets';
56

67
const paths = {
78

89
src: {
910
root: srcRoot,
10-
assets: srcRoot + '/assets',
11+
assets: srcRoot + '/' + assetsPath,
1112
fixtures: srcRoot + '/fixtures',
1213
documents: srcRoot + '/documents',
1314
views: srcRoot + '/views'
1415
},
1516

1617
dist: {
1718
root: distRoot, //where static files are to be saved
18-
assets: distRoot + '/assets',
19-
views: distRoot, //when working on with CMS, views may be stored in a diffrent folder
20-
revmap: 'assets/assets-map.json', //map of revved files
21-
usemin: distRoot //path to views to be processed by usemin/htmlrefs
19+
assets: distRoot + '/' + assetsPath,
20+
views: distRoot, //when working on with CMS, views may be stored in a different folder
21+
revmap: assetsPath + '/assets-map.json' //map of revved files
2222
},
2323

2424
js: 'javascripts',

build/gulp-tasks/modernizr.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66
module.exports = function (gulp, $, options) {
77

88
const defaultConfig = require('../gulp-config/modernizr.conf.json');
9+
const paths = options.paths;
10+
const tmpPath = options.assetsPath('dist.vendors').replace(paths.dist.root, paths.tmp);
911

1012
const distConfig = {
1113

1214
cache: true,
1315

1416
devFile: false,
1517

16-
dest: options.paths.tmp + '/assets/vendors/modernizr/modernizr.js',
18+
dest: tmpPath + '/modernizr/modernizr.js',
1719

1820
// Based on default settings on http://modernizr.com/download/
1921
options: defaultConfig.options,

build/gulp-tasks/views.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = function (gulp, $, options) {
1818
const fixturesPath = path.join(process.cwd(), options.paths.src.fixtures);
1919

2020

21-
var userRefPipe; //eslint-disable-line no-var
21+
var useRef; //eslint-disable-line no-var
2222

2323

2424
baseData.PRODUCTION = options.production;
@@ -59,15 +59,16 @@ module.exports = function (gulp, $, options) {
5959

6060
const styleFilter = $.filter('**/*.min.css', { restore: true });
6161
const jsFilter = $.filter('**/*.min.js', { restore: true });
62+
const assetsFilter = $.filter(['**/*.*', '!**/' + options.viewmatch], { restore: true });
6263

63-
userRefPipe = require('lazypipe')()
64+
useRef = require('lazypipe')()
6465
.pipe($.useref, {
6566
types: ['css', 'js', 'replace', 'remove'],
6667
searchPath: [paths.dist.root, paths.tmp],
6768
//just replace src
68-
replace: function (blockContent, target, attbs) {
69-
if (attbs) {
70-
return '<script src="' + target + '" ' + attbs + '></script>';
69+
replace: function (blockContent, target, attrs) {
70+
if (attrs) {
71+
return '<script src="' + target + '" ' + attrs + '></script>';
7172
}
7273
return '<script src="' + target + '"></script>';
7374
}
@@ -89,15 +90,20 @@ module.exports = function (gulp, $, options) {
8990
.pipe(() => {
9091
const vendorRegexp = new RegExp(paths.vendors);
9192
return $.if(vendorRegexp, $.header(options.banners.vendors, { pkg: options.pkg }));
92-
});
93+
})
94+
.pipe(() => assetsFilter)
95+
.pipe(gulp.dest, paths.dist.root)
96+
.pipe(() => assetsFilter.restore);
9397

9498
} else {
95-
userRefPipe = $.util.noop;
99+
useRef = $.util.noop;
96100
}
97101

98102
gulp.task('views', () => {
99103

100104
const data = {};
105+
const htmlFilter = $.filter('**/' + options.viewmatch, { restore: true });
106+
101107

102108
glob.sync('{,*/}*.json', { cwd: fixturesPath }).forEach((filename) => {
103109
const id = _.camelCase(filename.toLowerCase().replace('.json', ''));
@@ -109,11 +115,13 @@ module.exports = function (gulp, $, options) {
109115
errorHandler: $.notify.onError('Error: <%= error.message %>')
110116
}))
111117
.pipe(map((code) => env.renderString(code, Object.assign({}, baseData, data || {}))))
112-
.pipe(userRefPipe())
118+
.pipe(useRef())
113119
.pipe($.rename((filepath) => {
114120
filepath.basename = filepath.basename.replace('.nunj', ''); //eslint-disable-line no-param-reassign
115121
}))
122+
.pipe(htmlFilter)
116123
.pipe(gulp.dest(paths.dist.views))
124+
.pipe(htmlFilter.restore)
117125
.pipe($.if(options.production, $.rev.manifest(path.join(paths.dist.root, paths.dist.revmap), { merge: true })))
118126
.pipe($.if(options.production, gulp.dest('.')))
119127
.pipe($.if(options.isWatching, $.notify({ message: 'Views rendered', onLast: true })));

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "wok",
33
"description": "A Static Website Boilerplate",
4-
"version": "4.0.3",
4+
"version": "4.1.0",
55
"license": "MIT",
66
"repository": {
77
"type": "git",

0 commit comments

Comments
 (0)