Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Support CSS embedded in HTML files #66

Closed

Conversation

sasikanth513
Copy link
Contributor

@sasikanth513 sasikanth513 commented May 23, 2019

This should close #3

Issue

Right now, if you want to autoprefix css inside html file, you need to select the css part of the file and then select autoprefixer command.

Fix

As mentioned in this comment, using RebelMail/html-postcss package, we are able to detect css scope inside html and pass it to postcss.

Note: RebelMail/html-postcss package needs complete HTML to work, so if user selected part of css inside html file we're rolling back to using old process.

@sasikanth513
Copy link
Contributor Author

I didn't know I can test linting issues in local till now for this package. So more commits than expected. 😄

@sindresorhus sindresorhus changed the title Feature: Support CSS embedded in HTML Files Support CSS embedded in HTML files May 29, 2019
index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
@sindresorhus
Copy link
Owner

Can you fix the merge conflict?

sasikanth513 and others added 3 commits May 30, 2019 08:05
Co-Authored-By: Sindre Sorhus <sindresorhus@gmail.com>
Co-Authored-By: Sindre Sorhus <sindresorhus@gmail.com>
@sasikanth513
Copy link
Contributor Author

sure, will do it.

@sasikanth513
Copy link
Contributor Author

@sindresorhus fixed merge conflicts. Everything should work fine now.

@sindresorhus
Copy link
Owner

Prefixing the CSS in the HTML file works, but the command to remove prefixes does not work in the HTML file.

I just get an error message:

Unexpected '!'. Escaping special characters with \ may help.

@sasikanth513
Copy link
Contributor Author

@sindresorhus added option to remove prefixes from html file.

There seems to be some formatting issues here.

This is html file i'm testing on

Screenshot 2019-05-30 at 10 47 26 PM

it becomes this when autoprefix is done

Screenshot 2019-05-30 at 10 47 35 PM

and when we do autoprefix:remove prefixes this is how it becomes

Screenshot 2019-05-30 at 10 47 44 PM

@sasikanth513
Copy link
Contributor Author

@sindresorhus seems like above issue is there even with the published version, it is not introduced by this PR.

Should I open new issue for this?

@sindresorhus
Copy link
Owner

While the issue is not introduced in this PR, I think it should still be fixed here as the feature is not really usable without.

@sasikanth513
Copy link
Contributor Author

@sindresorhus sure, let me try this. Any inputs on where it might be the issue?

@sasikanth513
Copy link
Contributor Author

setting cascade property as false removes that multiple tabs issue (filter property in above screenshot) but the issue with :placeholder property remains.

@sasikanth513
Copy link
Contributor Author

just an update, I think formatting issues is because of cheerio package used by html-postcss package.

I tried to use different approach using first-man npm package but I was having issues adding it to the project.

@sasikanth513
Copy link
Contributor Author

Closing this as I can't figure out how to make indentation work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support CSS embedded in HTML files
2 participants