Skip to content
Permalink
Browse files

fix(template-webpack): properly remove stylesheet link from index.html

  • Loading branch information
malept committed Jul 15, 2019
1 parent 5b58606 commit 89176b4d025e2aba65a23f6d4f6869379b16aa3f
Showing with 11 additions and 2 deletions.
  1. +6 −2 packages/api/core/test/slow/api_spec_slow.ts
  2. +5 −0 packages/template/webpack/src/WebpackTemplate.ts
@@ -108,7 +108,7 @@ describe(`electron-forge API (with installer=${nodeInstaller})`, () => {
});
});

describe.only('init (with built-in templater)', () => {
describe('init (with built-in templater)', () => {
before(ensureTestDirIsNonexistent);

it('should succeed in initializing', async () => {
@@ -144,7 +144,11 @@ describe(`electron-forge API (with installer=${nodeInstaller})`, () => {
it('should move and rewrite the main process file', async () => {
await expectProjectPathNotExists(path.join('src', 'index.js'), 'file');
await expectProjectPathExists(path.join('src', 'main.js'), 'file');
expect(await fs.readFile(path.join(dir, 'src', 'main.js'))).to.match(/MAIN_WINDOW_WEBPACK_ENTRY/);
expect((await fs.readFile(path.join(dir, 'src', 'main.js'))).toString()).to.match(/MAIN_WINDOW_WEBPACK_ENTRY/);
});

it('should remove the stylesheet link from the HTML file', async () => {
expect((await fs.readFile(path.join(dir, 'src', 'index.html'))).toString()).to.not.match(/link rel="stylesheet"/);
});

after(async () => {
@@ -63,6 +63,11 @@ class WebpackTemplate implements ForgeTemplate {
if (line.includes('mainWindow.loadURL')) return ' mainWindow.loadURL(MAIN_WINDOW_WEBPACK_ENTRY);';
return line;
}, path.resolve(directory, 'src', 'main.js'));

await updateFileByLine(path.resolve(directory, 'src', 'index.html'), (line) => {
if (line.includes('link rel="stylesheet"')) return '';
return line;
});
});
}
}

0 comments on commit 89176b4

Please sign in to comment.
You can’t perform that action at this time.