Skip to content

Commit

Permalink
adds support for html base tag
Browse files Browse the repository at this point in the history
  • Loading branch information
bezoerb committed Sep 14, 2023
1 parent e01c8a4 commit f01ff24
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
4 changes: 1 addition & 3 deletions src/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,6 @@ export async function getDocumentPath(file, options = {}) {
return normalizePath(`/${path.relative(base, file.path || base)}`);
}

console.log('getDocumentPath')

// Check local and assume base path based on relative stylesheets
if (file.stylesheets) {
const relativeRefs = file.stylesheets.filter((href) => isRelative(href));
Expand Down Expand Up @@ -720,7 +718,7 @@ export async function getAssetPaths(document, file, options = {}, strict = true)

// Filter non-existent paths
const filtered = await filterAsync(paths, (f) => {
if (!f || (!isRemote(f) && !f?.includes(process.cwd()))) {
if (!f || (!isRemote(f) && isAbsolute(f) && !f?.includes(process.cwd()))) {
return false;
}

Expand Down
5 changes: 1 addition & 4 deletions test/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,15 @@ const getArgs = async (params = []) => {
await import('../cli.js');
process.argv = origArgv;
const {generate} = await import('../index.js');
// console.log('GENERATE:', generate.mock);
const [args] = generate.mock.calls;
const [opts] = args || [{}];
expect(generate).toHaveBeenCalledTimes(1);
return opts || {};
// return {};
};

const pipe = async (filename, args = []) => {
const cat = process.platform === 'win32' ? 'type' : 'cat';
const cmd = `${cat} ${filename} | node ${criticalBin} ${args.join(' ')}`;
console.log(cmd);
return pExec(cmd, {shell: true});
};

Expand Down Expand Up @@ -105,7 +102,7 @@ describe('CLI', () => {
expect(nn(stdout)).toBe(expected);
});

test.only('Pipe html file inside a folder to critical', async () => {
test('Pipe html file inside a folder to critical', async () => {
const {stdout, stderr} = await pipe(path.normalize('fixtures/folder/generate-default.html'), [
'--base',
'fixtures',
Expand Down

0 comments on commit f01ff24

Please sign in to comment.