Skip to content

Instantly share code, notes, and snippets.

@m00zi
Last active January 15, 2021 11:44
Show Gist options
  • Save m00zi/2e4df8993c6b2b778823d689fbe4658a to your computer and use it in GitHub Desktop.
Save m00zi/2e4df8993c6b2b778823d689fbe4658a to your computer and use it in GitHub Desktop.
// npm install fs-extra concat --save-dev
// place this file in the root of project next to angular.json
const fs = require('fs-extra');
const concat = require('concat');
(async function build() {
const files = [
'./dist/app/runtime.js',
'./dist/app/polyfills.js',
'./dist/app/main.js',
]
await fs.ensureDir('elements')
await concat(files, './elements/counter.js');
await fs.copy('./dist/app/styles.css', 'elements/styles.css')
})();
// Add this line to package.json under script
"build:elements": "ng build --prod --output-hashing none && node concatenate.js"
// npm run build:elements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment