@videinfra/static-website-builder 1.9.1 → 1.11.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.
- package/CHANGELOG.md +13 -0
- package/init/index.js +56 -56
- package/init/test/config/config.js +36 -36
- package/init/test/src/stylesheets/autoprefixer-test.scss +3 -3
- package/init/test/src/stylesheets/ignore-test.scss +4 -4
- package/init/test/src/stylesheets/nested-calc-test.scss +3 -3
- package/init/test/src/stylesheets/sub-folder/import-test.scss +2 -2
- package/lib/camelize-file-name.js +21 -21
- package/lib/get-config.js +157 -157
- package/lib/get-file-names.js +23 -23
- package/lib/get-path.js +109 -109
- package/lib/globs-helper.js +136 -136
- package/lib/log-error.js +15 -15
- package/lib/merge.js +27 -27
- package/package.json +4 -3
- package/plugins/sass-engine/preprocess-config.js +54 -54
- package/plugins/sass.js +38 -38
- package/plugins/twig-engine/preprocess-config.js +47 -47
- package/plugins/twig.js +65 -53
- package/tasks/data/data-loader-js.js +5 -5
- package/tasks/data/get-data.js +87 -87
- package/tasks/html/task.js +91 -91
- package/tasks/icons/config.js +52 -52
- package/tasks/javascripts/preprocess-config.js +42 -4
- package/tasks/javascripts/task.js +1 -1
- package/tasks/stylesheets/config.js +88 -88
- package/tasks/stylesheets/preprocess-config.js +41 -41
- package/tasks/stylesheets/task.js +69 -69
- package/tests/build/build.test.js +101 -101
- package/tests/camelize-file-name.test.js +11 -11
- package/tests/glob-helper.test.js +99 -99
- package/vendor/gulp-twig/LICENSE +20 -0
- package/vendor/gulp-twig/README.md +167 -0
- package/vendor/gulp-twig/index.js +130 -0
- package/vendor/gulp-twig/package.json +43 -0
- package/vendor/webpack-stream/index.js +261 -0
- package/vendor/webpack-stream/package.json +91 -0
- package/vendor/webpack-stream/readme.md +239 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# webpack-stream [](https://travis-ci.org/shama/webpack-stream)
|
|
2
|
+
|
|
3
|
+
Run [webpack](https://github.com/webpack/webpack) as a stream to conveniently integrate with gulp.
|
|
4
|
+
|
|
5
|
+
[](https://nodei.co/npm/webpack-stream/)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
If you have `npm` run the following command in the console `npm install --save-dev webpack-stream`
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
const gulp = require('gulp');
|
|
16
|
+
const webpack = require('webpack-stream');
|
|
17
|
+
gulp.task('default', function() {
|
|
18
|
+
return gulp.src('src/entry.js')
|
|
19
|
+
.pipe(webpack())
|
|
20
|
+
.pipe(gulp.dest('dist/'));
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The above will compile `src/entry.js` into assets with webpack into `dist/` with the output filename of `[hash].js` (webpack generated hash of the build).
|
|
25
|
+
|
|
26
|
+
You can pass webpack options in with the first argument, including `watch` which will greatly decrease compilation times:
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
return gulp.src('src/entry.js')
|
|
30
|
+
.pipe(webpack({
|
|
31
|
+
watch: true,
|
|
32
|
+
module: {
|
|
33
|
+
rules: [
|
|
34
|
+
{ test: /\.css$/, loader: 'style!css' },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
}))
|
|
38
|
+
.pipe(gulp.dest('dist/'));
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Or just pass in your `webpack.config.js`:
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
return gulp.src('src/entry.js')
|
|
45
|
+
.pipe(webpack( require('./webpack.config.js') ))
|
|
46
|
+
.pipe(gulp.dest('dist/'));
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
If you would like to use a different version of webpack than the one this plugin uses, pass in an optional 2nd argument:
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
const gulp = require('gulp');
|
|
53
|
+
const webpack = require('webpack');
|
|
54
|
+
const gulpWebpack = require('webpack-stream');
|
|
55
|
+
gulp.task('default', function() {
|
|
56
|
+
return gulp.src('src/entry.js')
|
|
57
|
+
.pipe(gulpWebpack({}, webpack))
|
|
58
|
+
.pipe(gulp.dest('dist/'));
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Pass in 3rd argument if you want to access the stats outputted from webpack when the compilation is done:
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
const gulp = require('gulp');
|
|
67
|
+
const webpack = require('webpack-stream');
|
|
68
|
+
gulp.task('default', function() {
|
|
69
|
+
return gulp.src('src/entry.js')
|
|
70
|
+
.pipe(webpack({
|
|
71
|
+
/* config */
|
|
72
|
+
}, null, function(err, stats) {
|
|
73
|
+
/* Use stats to do more things if needed */
|
|
74
|
+
}))
|
|
75
|
+
.pipe(gulp.dest('dist/'));
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### Usage with gulp watch
|
|
80
|
+
|
|
81
|
+
To use gulp `watch`, it's required that you explicitly pass webpack in the 2nd argument for a cached `compiler` instance to be used on subsequent runs.
|
|
82
|
+
|
|
83
|
+
Please note that gulp `watch` and webpack `watch` are mutually exclusive.
|
|
84
|
+
|
|
85
|
+
```javascript
|
|
86
|
+
var gulp = require('gulp');
|
|
87
|
+
var compiler = require('webpack');
|
|
88
|
+
var webpack = require('webpack-stream');
|
|
89
|
+
|
|
90
|
+
gulp.task('build', function() {
|
|
91
|
+
return gulp.src('src/entry.js')
|
|
92
|
+
.pipe(webpack({
|
|
93
|
+
/* config */
|
|
94
|
+
}, compiler, function(err, stats) {
|
|
95
|
+
/* Use stats to do more things if needed */
|
|
96
|
+
}))
|
|
97
|
+
.pipe(gulp.dest('dist/'));
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
gulp.task('default', ['build'], function() {
|
|
101
|
+
gulp.watch(['src/**/*.js'], ['build']);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### Multiple Entry Points
|
|
107
|
+
|
|
108
|
+
A common request is how to handle multiple entry points. You can continue to pass in an `entry` option in your typical webpack config like so:
|
|
109
|
+
|
|
110
|
+
```js
|
|
111
|
+
const gulp = require('gulp');
|
|
112
|
+
const webpack = require('webpack-stream');
|
|
113
|
+
gulp.task('default', function() {
|
|
114
|
+
return gulp.src('src/entry.js')
|
|
115
|
+
.pipe(webpack({
|
|
116
|
+
entry: {
|
|
117
|
+
app: 'src/app.js',
|
|
118
|
+
test: 'test/test.js',
|
|
119
|
+
},
|
|
120
|
+
output: {
|
|
121
|
+
filename: '[name].js',
|
|
122
|
+
},
|
|
123
|
+
}))
|
|
124
|
+
.pipe(gulp.dest('dist/'));
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Or pipe files through a stream that names the chunks. A convenient library for this is [vinyl-named](https://github.com/shama/vinyl-named):
|
|
129
|
+
|
|
130
|
+
```js
|
|
131
|
+
const gulp = require('gulp');
|
|
132
|
+
const webpack = require('webpack-stream');
|
|
133
|
+
const named = require('vinyl-named');
|
|
134
|
+
gulp.task('default', function() {
|
|
135
|
+
return gulp.src(['src/app.js', 'test/test.js'])
|
|
136
|
+
.pipe(named())
|
|
137
|
+
.pipe(webpack())
|
|
138
|
+
.pipe(gulp.dest('dist/'));
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The above `named()` stream will add a `.named` property to the vinyl files passing through. The `webpack()` stream will read those as entry points and even group entry points with common names together.
|
|
143
|
+
|
|
144
|
+
#### Source Maps
|
|
145
|
+
|
|
146
|
+
Source maps are built into webpack, specify a [devtool](https://webpack.github.io/docs/configuration.html#devtool):
|
|
147
|
+
|
|
148
|
+
```js
|
|
149
|
+
const gulp = require('gulp');
|
|
150
|
+
const webpack = require('webpack-stream');
|
|
151
|
+
const named = require('vinyl-named');
|
|
152
|
+
gulp.task('default', function() {
|
|
153
|
+
return gulp.src(['src/app.js', 'test/test.js'])
|
|
154
|
+
.pipe(named())
|
|
155
|
+
.pipe(webpack({
|
|
156
|
+
devtool: 'source-map'
|
|
157
|
+
}))
|
|
158
|
+
.pipe(gulp.dest('dist/'));
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Now the appropriate `.map` files will be emitted. Or set to `inline-source-map`
|
|
163
|
+
to inline the source maps into the files.
|
|
164
|
+
|
|
165
|
+
If you need further special handling of source maps, such as using with
|
|
166
|
+
[gulp-sourcemaps](https://github.com/floridoo/gulp-sourcemaps) then just pipe
|
|
167
|
+
to a stream and handle the source map files emitted by webpack:
|
|
168
|
+
|
|
169
|
+
```js
|
|
170
|
+
const gulp = require('gulp');
|
|
171
|
+
const webpack = require('webpack-stream');
|
|
172
|
+
const named = require('vinyl-named');
|
|
173
|
+
const through = require('through2');
|
|
174
|
+
const sourcemaps = require('gulp-sourcemaps');
|
|
175
|
+
gulp.task('default', function() {
|
|
176
|
+
return gulp.src(['src/app.js', 'test/test.js'])
|
|
177
|
+
.pipe(named())
|
|
178
|
+
.pipe(webpack({
|
|
179
|
+
devtool: 'source-map'
|
|
180
|
+
}))
|
|
181
|
+
.pipe(sourcemaps.init({loadMaps: true}))
|
|
182
|
+
.pipe(through.obj(function (file, enc, cb) {
|
|
183
|
+
// Dont pipe through any source map files as it will be handled
|
|
184
|
+
// by gulp-sourcemaps
|
|
185
|
+
const isSourceMap = /\.map$/.test(file.path);
|
|
186
|
+
if (!isSourceMap) this.push(file);
|
|
187
|
+
cb();
|
|
188
|
+
}))
|
|
189
|
+
.pipe(sourcemaps.write('.'))
|
|
190
|
+
.pipe(gulp.dest('dist/'));
|
|
191
|
+
});
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
#### Multi-compiler support
|
|
195
|
+
|
|
196
|
+
Multiple compilers are supported, but instead of passing the webpack configuration directly, you have to wrap it in an object under the key 'config'.
|
|
197
|
+
|
|
198
|
+
```js
|
|
199
|
+
const gulp = require('gulp');
|
|
200
|
+
const webpack = require('webpack-stream');
|
|
201
|
+
gulp.task('default', function() {
|
|
202
|
+
return gulp.src('src/entry.js')
|
|
203
|
+
.pipe(webpack({
|
|
204
|
+
config : require('./webpack.config.js')
|
|
205
|
+
}))
|
|
206
|
+
.pipe(gulp.dest('dist/'));
|
|
207
|
+
});
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Release History
|
|
211
|
+
* Please check the [commit log](https://github.com/shama/webpack-stream/commits/master) in the future for release history.
|
|
212
|
+
* 4.0.0 - Update `webpack` to `^3.4.1`. Update `memory-fs` and `vinyl` dependencies. Emit `compilation-error` instead of `error` when watching (@jeroennoten). Fix error when compiler throws an error (@renminghao). Fix error when stats is undefined (@Simek).
|
|
213
|
+
* 3.2.0 - Ability to use multiple compilers (@saschagehlich).
|
|
214
|
+
* 3.1.0 - Better error output (@hi-q).
|
|
215
|
+
* 3.0.1 - Fix fonts being passed through streams (@mattlewis92).
|
|
216
|
+
* 3.0.0 - Remove special handling of source maps. Update dependencies.
|
|
217
|
+
* 2.3.0 - Emit stats.compilation.errors as `error` (@JakeChampion).
|
|
218
|
+
* 2.2.0 - Add support for source maps (@OliverJAsh).
|
|
219
|
+
* 2.1.0 - Avoid modifying options by reference (@shinuza). Replace log with correct package name (@vinnymac).
|
|
220
|
+
* 2.0.0 - Rename to webpack-stream and now it's totally not a gulp plugin.
|
|
221
|
+
* 1.5.0 - Update webpack to 1.9.x (@nmccready). Update other dependencies.
|
|
222
|
+
* 1.4.0 - Update webpack to 1.8.x (@Zolmeister).
|
|
223
|
+
* 1.3.2 - Fix another place with ? in name (@raphaelluchini).
|
|
224
|
+
* 1.3.1 - Fix for paths with ? in their name (@raphaelluchini).
|
|
225
|
+
* 1.3.0 - Updating to webpack >= 1.7.
|
|
226
|
+
* 1.2.0 - Updating to webpack >= 1.5, vinyl >= 0.4, memory-fs >= 0.2.
|
|
227
|
+
* 1.1.2 - Fixes to default stats for logging (@mdreizin).
|
|
228
|
+
* 1.1.1 - Add additional stats to default logging (@mdreizin).
|
|
229
|
+
* 1.1.0 - Exposes internal webpack if asked via `require('webpack-stream').webpack`
|
|
230
|
+
* 1.0.0 - Support named chunks pipe'd in for multiple entry points.
|
|
231
|
+
* 0.4.1 - Fixed regression for multiple entry point support.
|
|
232
|
+
* 0.4.0 - Display an error message if there are no input files (@3onyc). Add message on why task is not finishing, Add ability to track compilation progress, Add ability to configure stats output via options (@kompot). Bump webpack version (@koistya).
|
|
233
|
+
* 0.3.0 - Update deps (@kompot). Fixes to determining entry (@btipling and @abergs).
|
|
234
|
+
* 0.2.0 - Support for `watch` mode (@ampedandwired).
|
|
235
|
+
* 0.1.0 - Initial release
|
|
236
|
+
|
|
237
|
+
## License
|
|
238
|
+
Copyright (c) 2018 Kyle Robinson Young
|
|
239
|
+
Licensed under the MIT license.
|