Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements for Javascript asset #7

Merged
merged 4 commits into from
Mar 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Resources/Private/Assets/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ document.addEventListener('click', function(event) {
EMBED_ELEMENT.innerHTML = JSON.parse(CONTAINER.dataset.embedHtml);

// Run trough every script and active it
[...EMBED_ELEMENT.querySelectorAll('script')].forEach(scriptTag => {
Array.from(EMBED_ELEMENT.querySelectorAll('script')).forEach(scriptTag => {
if (scriptTag.src) {
const TAG = document.createElement('script');
TAG.src = scriptTag.src;
Expand Down
3 changes: 1 addition & 2 deletions Resources/Public/Main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Resources/Public/Main.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@
"url": "git://github.com/betterembed/neos-betterembed.git"
},
"devDependencies": {
"@babel/core": "^7.8.7",
"@babel/preset-env": "^7.8.7",
"@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.0",
"autoprefixer": "^9.7.4",
"cssnano": "^4.1.10",
"join-array": "^1.1.2",
"postcss-banner": "^3.0.1",
"postcss-cli": "^7.1.0",
"rollup": "^1.32.1",
"rollup": "^2.1.0",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-license": "^0.13.0",
"rollup-plugin-terser": "^5.3.0",
"sass": "^1.26.3"
},
Expand Down
27 changes: 8 additions & 19 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import babel from 'rollup-plugin-babel';
import { terser } from 'rollup-plugin-terser';
import license from 'rollup-plugin-license';
import joinArray from 'join-array';
import composer from './composer.json';

Expand All @@ -9,29 +8,19 @@ const AUTHORS = joinArray({
max: 4
});

const BANNER_CONTENT = `${composer.extra.neos['package-key']} - created by ${AUTHORS}
@link ${composer.homepage}
Copyright ${parseInt(new Date().getFullYear(), 10)} ${AUTHORS}
Licensed under ${composer.license}`;
const BANNER_CONTENT = `/*!
* ${composer.extra.neos['package-key']} - created by ${AUTHORS}
* @link ${composer.homepage}
* Copyright ${parseInt(new Date().getFullYear(), 10)} ${AUTHORS}
* Licensed under ${composer.license}
*/`;

export default [
{
input: 'Resources/Private/Assets/Main.js',
plugins: [
babel(),
terser({
output: {
comments: false
}
}),
license({
banner: {
content: BANNER_CONTENT,
commentStyle: 'ignored'
}
})
],
plugins: [babel(), terser()],
output: {
banner: BANNER_CONTENT,
sourcemap: true,
file: 'Resources/Public/Main.js',
format: 'iife'
Expand Down
Loading