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

Print deprecation message only on usage of the returned .js() and .css() value #57

Merged
merged 1 commit into from
Jul 31, 2019

Conversation

trygve-lie
Copy link
Contributor

From V3 to V4 we deprecated the return value from the .js() and .css() methods. In V5 we will remove that these return a value.

Due to this an deprecation message was added but the deprecation message is printed when these methods are used. Calling these methods to set a value will trigger the deprecation message which are not quite what we want.

This little hack makes it so that the deprecation message is printed only when one try to use the returned value from these methods.

This will not trigger a deprecation message:

const css = podlet.css({ value: '/public/css/main.css' });

This will trigger a deprecation message:

const css = podlet.css({ value: '/public/css/main.css' });
app.get(css, (req, res) => {
    [ .... ]
});

Copy link
Contributor

@alexanbj alexanbj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 👍

Copy link
Member

@digitalsadhu digitalsadhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's filthy, but I like it ;)

Copy link
Member

@stipsan stipsan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hehe 🙈

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

Successfully merging this pull request may close these issues.

4 participants