Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/4.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
borodean committed Feb 1, 2016
2 parents b2db843 + 89eaeb8 commit f7be70e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ var unquote = require('./lib/unquote');
var util = require('util');

module.exports = postcss.plugin('postcss-assets', function (options) {
options = options || {};

if (options.relative === undefined) {
options.relative = false;
}

var resolver = Assets(options);

function measure(path, density) {
Expand Down
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postcss-assets",
"version": "4.0.0",
"version": "4.0.1",
"description": "PostCSS plugin to manage assets",
"keywords": [
"assets",
Expand All @@ -14,7 +14,14 @@
"url"
],
"license": "MIT",
"author": "Vadym Borodin <[email protected]>",
"author": "Vadym Borodin <[email protected]> (http://borodean.com)",
"contributors": [
"Alexey Plutalov <[email protected]> (https://twitter.com/demiazz)",
"Andrey Sitnik <[email protected]> (http://sitnik.ru)",
"Dave Clayton <[email protected]> (http://www.dave78.com)",
"Ivan Vlasenko (https://github.com/avanes)",
"Pascal Duez (http://pascalduez.me)"
],
"repository": "assetsjs/postcss-assets",
"scripts": {
"coveralls": "nyc report --reporter=text-lcov | coveralls",
Expand Down
10 changes: 4 additions & 6 deletions test/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ var plugin = require('..');
var postcss = require('postcss');
var test = require('ava');

function process(css, options, postcssOptions) {
return postcss().use(plugin(options)).process(css, postcssOptions);
function process(css, options) {
return postcss().use(plugin(options)).process(css, {
from: path.resolve('fixtures/images/style.css')
});
}

test('resolves urls', function (t) {
Expand All @@ -25,8 +27,6 @@ test('resolves urls from the current path', function (t) {
return process("a { b: resolve('picture.png') }", {
basePath: 'fixtures',
baseUrl: 'http://example.com/wp-content/themes'
}, {
from: path.resolve('fixtures/images/style.css')
})
.then(function (result) {
t.is(result.css, "a { b: url('http://example.com/wp-content/themes/images/picture.png') }");
Expand All @@ -37,8 +37,6 @@ test('resolves relative urls from the current path', function (t) {
return process("a { b: resolve('fonts/empty-sans.woff') }", {
basePath: 'fixtures',
relative: true
}, {
from: path.resolve('fixtures/images/style.css')
})
.then(function (result) {
t.is(result.css, "a { b: url('../fonts/empty-sans.woff') }");
Expand Down

0 comments on commit f7be70e

Please sign in to comment.