1st request #1
15
blog/gulp.md
Normal file
15
blog/gulp.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Gulp
|
||||||
|
|
||||||
|
Gulp can complement webpack by adding additional workflows to your project. Webpack can be used to package your bundles, gulp can be used to run additional things before or after the build.
|
||||||
|
|
||||||
|
<https://forestry.io/blog/gulp-and-webpack-best-of-both-worlds/>
|
||||||
|
|
||||||
|
Using node we could run our webpack command and build commands seperately in the workflow. We could use gulp to use one command to do both. We can also use gulp to build the search index of an app as part of this workflow.
|
||||||
|
|
||||||
|
## Creating a gulpfile
|
||||||
|
|
||||||
|
`yarn add gulp`
|
||||||
|
|
||||||
|
Create a `gulpfile.js` in the root of your project next to the `package.json` file.
|
||||||
|
|
||||||
|
|
||||||
15
blog/gulpfile.js
Normal file
15
blog/gulpfile.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import run from "build-lunrjs-index";
|
||||||
|
import { promise } from "readdirp";
|
||||||
|
|
||||||
|
const gulp = require("gulp");
|
||||||
|
// const webpack = require("webpack");
|
||||||
|
// const webpackConfig = require("./web")
|
||||||
|
|
||||||
|
function buildSearch(cb) {
|
||||||
|
return new promise((resolve, reject) => {
|
||||||
|
run();
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.build = buildSearch;
|
||||||
@@ -1,7 +1,12 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"gulp": "^4.0.2",
|
||||||
"lunr": "^2.3.8",
|
"lunr": "^2.3.8",
|
||||||
"parser-front-matter": "^1.6.4",
|
"parser-front-matter": "^1.6.4",
|
||||||
"readdirp": "^3.4.0"
|
"readdirp": "^3.4.0"
|
||||||
}
|
},
|
||||||
|
"scripts": {
|
||||||
|
"buildSearch": "gulp buildSearch"
|
||||||
|
},
|
||||||
|
"type": "module"
|
||||||
}
|
}
|
||||||
|
|||||||
2075
blog/yarn.lock
2075
blog/yarn.lock
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user