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

Plugin's options parameter is now required (breaking change since v6) #87

Closed
elisherer opened this issue Apr 3, 2017 · 2 comments
Closed

Comments

@elisherer
Copy link

elisherer commented Apr 3, 2017

I used postcss-url as-is no custom options (not passing an options object).
Now i'm required to pass an empty object because otherwise I fail an options.url check as soon as replaceUrl is called in the index.js file.

plugin:

module.exports = postcss.plugin('postcss-url', (options) =>
...
            return declProcessor(options, result, dir, decl);
...
);

declProcessor:

const declProcessor = (options, result, dir, decl) => {
...
            const newUrl = replaceUrl(url, dir, options, result, decl);
...
};

replaceUrl:

const replaceUrl = (url, dir, options, result, decl) => {
    const isFunction = typeof options.url === 'function';
                                      ^ fails here!
...
};

I think a simple

module.exports = postcss.plugin('postcss-url', (options = {}) =>

should solve it.

@sergcen
Copy link
Collaborator

sergcen commented Apr 3, 2017

@elisherer thanks for feedback, now i will fix it

@sergcen
Copy link
Collaborator

sergcen commented Apr 3, 2017

@elisherer done!

@sergcen sergcen closed this as completed Apr 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants