Run the following command one by one:
npm install -g vulcanize crisper
Note: Ubuntu users may need to prefix the above command with sudo
.
Put all the html imports in your files in a single file elements.html
. Don't worry about a file being imported more than once, it'll be crunched down to a single import.
on your elements.html
file, run the following commands:
cd PATH/TO/IMPORTFILE/
vulcanize elements.html -o elements.vulc.html --strip-comments --inline-css --inline-js
crisper --source elements.vulc.html --html build.html --js build.js
Vulcanize retrieved source code of all the imports, then replaced imports by their source code.
Crisper took all the js out of the elements.vulc.html file, put it in single build.js file, set a script
tag referring the build.js
file in the build.html
file
Open HTML minifier
Open build.html
Copy all its code
In the HTML minfier's first textarea, paste the code you copied from build.html
Click Minify button
In the second textarea, minified code will appear. Copy that
Create a build.min.html
file and paste all your copied code in it
Open JSCompress
Select 2nd tab i.e. Upload JavaScript Files
Click on Choose Files
Select build.js
file
Click on Compress button
Download the file as build.js
in the same directory as of build.min.html
Remove all previous imports from those HTmL files from which you copy-pasted the imports. Replace imports with
<link rel="import" href="PATH/TO/IMPORTFILE/build.min.html">