parcel-plugin-change-file
v1.3.0
Published
[中文文档](./README-cn.md)
Downloads
63
Readme
:ambulance: parcel-plugin-change-file
:bulb: How ignore parcel bundler file ?
On Parcel build end, change index.html context, and copy static files in outDir
:building_construction: Install
$ yarn add -D parcel-plugin-change-file
:bookmark: Feature1: Exegesis index.html
Add <!--[ your-code ]-->
<body>
<!--[ <script src="lodash.min.js"></script> ]-->
</bodt>
The lodash.min.js jump to parcel bundler, this build end html:
<body>
<script src="lodash.min.js"></script>
</bodt>
:lipstick: Feature2: Replace index.html
Add <!-- parcel-plugin-change-file-i -->
in index.html
<header>
<title><!-- parcel-plugin-change-file-0 --></title>
</header>
Create parcel-plugin-change-file.js
in project-dir
module.exports = {
html: ['Product Name'],
};
parcel build end:
<header>
<title>Product Name</title>
</header>
:truck: Feature3: Copy files to outDir
Create parcel-plugin-change-file.js
in project-dir
module.exports = {
copy: ['src/assets'],
};
:beer: OK, after build, we change static html and files!
File tree like this:
:beer: All config
module.exports = {
timeout: 30, // setTimeout replace Html file
replaceName: 'parcel-plugin-change-file', // default html replaceName
html: ['hello'], // change string to html
copy: ['src/assets'], // copy files in outDir
};
How did ignore parcel-plugin-change-file feature?
Add changeFile=false
$ changeFile=false parcel index.html