Skip to content

Commit

Permalink
chore: renamed flag to --skip-absolute-urls
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugene Park committed Apr 6, 2016
1 parent 15e6b0d commit 825ec60
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions cli/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function options(args) {
'noimages',
'nocompress',
'nosvg',
'same-origin-only',
'skip-absolute-urls',
'videos',
'inlinemin',
],
Expand Down Expand Up @@ -41,8 +41,8 @@ function options(args) {
argv.compressJS = false;
argv.collapseWhitespace = false;
}
if (argv['same-origin-only']) {
argv.sameOriginOnly = true;
if (argv['skip-absolute-urls']) {
argv.skipAbsoluteUrls = true;
}
argv.images = !argv.noimages;

Expand Down
4 changes: 2 additions & 2 deletions docs/usage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
-i, --noimages don't encode images - keeps files size small, but more requests
-o, --videos encode videos (and their poster image) - disabled by default
-s, --nosvg don't compress SVG (through SVGO)
--same-origin-only
don't inline files with URLs on other hosts (only local files)
-v, --verbose echo on STDERR the progress of inlining
-V, --version output the version number
-h, --help output usage information
-m, --inlinemin inline minified files
--skip-absolute-urls
don't inline files with fully-qualified absolute URLs

Options:

Expand Down
2 changes: 1 addition & 1 deletion lib/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ module.exports = function () {
compressJS: true,
collapseWhitespace: true,
nosvg: false, // by default, DO compress SVG with SVGO
sameOriginOnly: false,
skipAbsoluteUrls: false,
};
};
2 changes: 1 addition & 1 deletion lib/tasks/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function resolve(inliner, todo, $) {
return todo.map(function images(image) {
var url = inliner.resolve(inliner.url, $(image).attr('src'));

if (inliner.options.sameOriginOnly &&
if (inliner.options.skipAbsoluteUrls &&
(url.indexOf('//') === 0 || url.indexOf('http') === 0)) {
debug('skipping remote image');
inliner.emit('progress', 'skipping remote image');
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function resolve(inliner, todo, $) {
inliner.emit('progress', 'skipping analytics script');
// ignore analytics
return false;
} else if (inliner.options.sameOriginOnly &&
} else if (inliner.options.skipAbsoluteUrls &&
(src.indexOf('//') === 0 || src.indexOf('http') === 0)) {
debug('skipping remote scripts');
inliner.emit('progress', 'skipping remote script');
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/links.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function resolve(inliner, todo, $) {
if (url.indexOf('http') !== 0) {
url = inliner.resolve(inliner.url, url);
}
if (inliner.options.sameOriginOnly &&
if (inliner.options.skipAbsoluteUrls &&
(url.indexOf('//') === 0 || url.indexOf('http') === 0)) {
debug('skipping remote links');
inliner.emit('progress', 'skipping remote links');
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/videos.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function resolve(inliner, todo, $) {
var url = inliner.resolve(inliner.url, $(video).attr('src'));
var posterUrl = inliner.resolve(inliner.url, $(video).attr('poster'));

if (inliner.options.sameOriginOnly &&
if (inliner.options.skipAbsoluteUrls &&
(url.indexOf('//') === 0 || url.indexOf('http') === 0)) {
debug('skipping remote video');
inliner.emit('progress', 'skipping remote video');
Expand Down
4 changes: 0 additions & 4 deletions test/fixtures/inline-same-origin-only.opts.json

This file was deleted.

4 changes: 4 additions & 0 deletions test/fixtures/inline-skip-absolute-urls.opts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"skipAbsoluteUrls": true,
"videos": true
}

0 comments on commit 825ec60

Please sign in to comment.