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

Process inline styles and scripts #1456

Merged
merged 15 commits into from Jul 21, 2018
2 changes: 0 additions & 2 deletions src/assets/HTMLAsset.js
Expand Up @@ -204,8 +204,6 @@ class HTMLAsset extends Asset {
}
}

console.log(type);

parts.push({type, value});

if (!node.attrs) {
Expand Down
16 changes: 16 additions & 0 deletions test/html.js
Expand Up @@ -638,4 +638,20 @@ describe('html', function() {

assert(html.includes('<style type="text/css">.index{color:#00f}</style>'));
});

it.only('should process inline non-js scripts', async function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a heads up, you've left an only call here

let b = await bundle(
__dirname + '/integration/html-inline-coffeescript/index.html',
{production: true}
);

await assertBundleTree(b, {
name: 'index.html',
assets: ['index.html']
});

let html = await fs.readFile(__dirname + '/dist/index.html', 'utf8');

assert(html.includes('alert("Hello, World!")'));
});
});
11 changes: 11 additions & 0 deletions test/integration/html-inline-coffeescript/index.html
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Inline JavaScript Parcel</title>
</head>
<body>
<script type="application/coffee">
alert "Hello, World!"
</script>
</body>
</html>