diff --git a/index.js b/index.js index 4f033d4..151d61f 100644 --- a/index.js +++ b/index.js @@ -1,9 +1,12 @@ +'use strict'; + const postcss = require('postcss'); const functions = require('postcss-functions'); const consistent = require('consistent'); const url = require('url'); -module.exports = postcss.plugin('prefix', (options = {}) => { +module.exports = postcss.plugin('prefix', (options) => { + options = options || {}; let prefix = options.prefix || ''; const useUrl = options.useUrl || false; const exclude = options.exclude || null; @@ -31,7 +34,8 @@ module.exports = postcss.plugin('prefix', (options = {}) => { return ring.get(path); } - this.formatUrl = (path, includePrefix = true) => { + this.formatUrl = (path, includePrefix) => { + includePrefix = typeof includePrefix !== 'undefined' ? includePrefix : true; const sanitizedPath = path.replace(/['"]/g, ''); if ((exclude && exclude.test(path)) || /^([a-z]+:\/\/|\/\/)/i.test(path)) { diff --git a/package.json b/package.json index 73ebdf0..7ba7372 100644 --- a/package.json +++ b/package.json @@ -4,14 +4,20 @@ "description": "Prefix URLs with CDN", "main": "index.js", "scripts": { - "test": "ava --fail-fast test" + "test": "ava test" }, "keywords": [ "postcss", "postcss-plugin", - "cdn" + "cdn", + "prefix", + "url" ], "author": "Kevin Smithson ", + "repository": { + "url": "https://github.com/smitt04/postcss-prefix-url.git", + "type": "git" + }, "license": "ISC", "dependencies": { "consistent": "^1.1.0",