build & pack anything your way!
module.exports = {
output: {
// Join .js files
"build/bundle.js": "src/js/**.js",
// Join .css files
"build/bundle.css": "src/css/**.css",
// Copy files
"build/**": "src/copy/**"
}
};
npm install @vimlet/bundl
npx @vimlet/bundl
module.exports = {
output: {
// Join .js files and minify
"build/bundle.js": {
use: async function (entry) {
entry.content = (await require("uglify-js").minify(entry.content.toString("utf8")));
return entry;
},
input: "src/js/**.js"
},
// ...
}
};
module.exports = {
output: {
// Build on file change
watch: "src",
// Name with hash to avoid cache issues
"build/bundle.{{hash}}.js": {
order: 1,
input: "src/js/**.js"
},
// Templating parsing support
"build/**": {
order: 1,
parse: true
input: "src/copy/**"
}
}
};
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<!-- Parse will inject bundle.hash.js here -->
<script src="/<% hash('bundle.js') %>"></script>
</head>
<body>
<!-- Templating can be used for any purpose -->
The answer to everything is <%= Math.sqrt(1764) %>!
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<!-- Parse will inject bundle.hash.js here -->
<script src="/bundle.A2DF32.js"></script>
</head>
<body>
<!-- Templating can be used for any purpose -->
The answer to everything is 42!;
</body>
</html>