4

Is there a way webpack can process my HTML tags such as

<link rel="stylesheet" href="./style.css">
<script src="./script.js"></script>

And bundle them into

<style>
  //contents of minified style.css 
</style>
<script>
  //bundled and minified script.js
</script>

So I can serve a single file from my servers? I managed to do this with the Processhtml grunt plugin, but I'm not using grunt as build system on this project.

2
  • Maybe html-webpack-plugin is worth a look? I have a feeling you could apply a couple of loaders within a template through it to pull this off. Commented Apr 3, 2016 at 7:14
  • try GULP its a built system for web applications. Commented Apr 3, 2016 at 7:24

2 Answers 2

2

You can achieve this with webpack using; extract-text-webpack-plugin, html-webpack-plugin and UglifyJsPlugin there's also uglify loader if you want to uglify during bundling, as the plugin does the uglify after the bundle is created.

Sign up to request clarification or add additional context in comments.

Comments

0

html-webpack-inline-source-plugin should be what you're looking for. It is a plugin for html-webpack-plugin which itself is a plugin for webpack. So basically works as a plugin for a plugin for webpack. The github page shows a very simple example on how to do exactly what you're looking for.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.