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

Css as string #291

Closed
Diokuz opened this issue Mar 20, 2018 · 2 comments
Closed

Css as string #291

Diokuz opened this issue Mar 20, 2018 · 2 comments

Comments

@Diokuz
Copy link

Diokuz commented Mar 20, 2018

I have css as string, no file. Is there a way to tell critical to get css string, not the file?

const css = 'div { color: red }'
const html = '<div>Hello</div>'

critical({ html, css }, function(err, output) {})
@bezoerb
Copy link
Collaborator

bezoerb commented Jan 27, 2024

#584

@bezoerb
Copy link
Collaborator

bezoerb commented Jan 28, 2024

Should be fixed in v7.1.0
You should now be able to also pass plain css to critical using the css option:

generate({
  css: `html{display:block;}.someclass{color:red}`
}, (err, output) => {
    console.log(output)
});

or via CLI:

critical http://my-domain.com -c 'html{display:block;}.someclass{color:red}'

Closing this now.
if there are any issues with the new feature please continue in #588

@bezoerb bezoerb closed this as completed Jan 28, 2024
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