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

add support for link preload hrefs #142

Closed
wants to merge 3 commits into from
Closed
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
7 changes: 6 additions & 1 deletion lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ function generate(opts) {
}

// Oust extracts a list of your stylesheets
var stylesheets = oust(html.toString(), 'stylesheets').map(file.resourcePath(opts));
var stylesheets = [
oust(html.toString(), 'stylesheets'),
oust(html.toString(), 'preload')
].reduce(function (a, b) {
return a.concat(b);
}, []).map(file.resourcePath(opts));
debug('Stylesheets: ' + stylesheets);
return Promise.map(stylesheets, file.assertLocal(opts));
// read files
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"meow": "^3.3.0",
"mime-types": "^2.1.6",
"object-assign": "^4.0.1",
"oust": "^0.2.3",
"oust": "^0.3.0",
"parseurl": "^1.3.0",
"penthouse": "^0.9.2",
"postcss": "^5.0.5",
Expand Down
6 changes: 3 additions & 3 deletions test/05-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('CLI', function () {

var expected = fs.readFileSync(path.join(__dirname, 'expected/generate-default.css'), 'utf8');
cp.stdout.on('data', function (data) {
assert.strictEqual(nn(data), nn(expected));
assert.strictEqual(nn(data.toString()), nn(expected));
done();
});
});
Expand All @@ -60,7 +60,7 @@ describe('CLI', function () {

var expected = fs.readFileSync(path.join(__dirname, 'expected/generate-default.css'), 'utf8');
cp.stdout.on('data', function (data) {
assert.strictEqual(nn(data), nn(expected));
assert.strictEqual(nn(data.toString()), nn(expected));
done();
});
});
Expand Down Expand Up @@ -103,7 +103,7 @@ describe('CLI', function () {

var expected = fs.readFileSync(path.join(__dirname, 'expected/generate-default.css'), 'utf8');
cp.stdout.on('data', function (data) {
assert.strictEqual(nn(data), nn(expected));
assert.strictEqual(nn(data.toString()), nn(expected));
done();
});
});
Expand Down