Skip to content

Commit

Permalink
strip out lit routes
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Aug 2, 2020
1 parent 78afc28 commit cece625
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions packages/cli/src/lifecycles/serialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ module.exports = serializeBuild = async (compilation) => {
.replace('<script></script>', apolloScript);

if (isStrictMode) { // no javascript
html = html.replace(/<script type="text\/javascript" src="\/index.*.bundle\.js"><\/script>/, '');
html = html.replace(/<script charset="utf-8" src="\/*.*.bundle\.js"><\/script>/, '');
html = html.replace(/<script type="text\/javascript" src="\/index.*.bundle\.js"><\/script>/, ''); // main bundle
html = html.replace(/<script charset="utf-8" src="\/*.*.bundle\.js"><\/script>/, ''); // dynamic / import() bundles
html = html.replace(/<lit-route path="(.*)" component="(.*)" class="(.*)">(.*)<\/lit-route>/g, ''); // lit redux routes
} else if (mode === 'spa') { // all the javascript, and async!
html = html.replace(/<script type="text\/javascript"/, '<script async="true" type="text/javascript"');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('Build Greenwood With: ', function() {
it('should have the correct route tags in the <body> like default app template', function() {
const routes = dom.window.document.querySelectorAll('body lit-route');

expect(routes.length).to.be.equal(4);
expect(routes.length).to.be.equal(2);
});

it('should have the expected heading text within the index page in the public directory', function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('Build Greenwood With: ', function() {
it('should have the correct route tags in the <body> like default app template', function() {
const routes = dom.window.document.querySelectorAll('body lit-route');

expect(routes.length).to.be.equal(3);
expect(routes.length).to.be.equal(2);
});

it('should have the expected heading text within the index page in the public directory', function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('Build Greenwood With: ', function() {
it('should have the correct route tags in the <body>', function() {
const routes = dom.window.document.querySelectorAll('body lit-route');

expect(routes.length).to.be.equal(2);
expect(routes.length).to.be.equal(1);
});

it('should have the expected heading text within the index page in the public directory', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/smoke-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function defaultIndex(label) {
it('should have the correct route tags in the <body>', function() {
const routes = dom.window.document.querySelectorAll('body lit-route');

expect(routes.length).to.be.equal(3);
expect(routes.length).to.be.equal(2);
});

it('should have the expected heading text within the index page in the public directory', function() {
Expand Down

0 comments on commit cece625

Please sign in to comment.