-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add Input#document
#1996
Add Input#document
#1996
Conversation
@@ -33,6 +33,9 @@ class Input { | |||
this.hasBOM = false | |||
} | |||
|
|||
this.document = this.css | |||
if (opts.document) this.document = opts.document.toString() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chose to use opts.document
and add document
to ProcessOptions
.
Alternatively it could also be less exposed and only exists as a field on Input
.
let root = parse('a {} b {}')
root.source.input.document = '<style>a {} b {}</style>';
We would still keep this.document = this.css
to make sure that there is always a value.
lib/input.d.ts
Outdated
* Input source with support for non-CSS documents. | ||
* | ||
* ```js | ||
* const input = postcss.parse('a{}', { from: file }).input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s use HTML in example to show why we need document
Looks amazing (only a few small docs changes suggested), but I prefer to merge and release it after holidays to avoid rush fixes in the middle of holiday :D |
Co-authored-by: Andrey Sitnik <andrey@sitnik.ru>
Thank you for the review 🙇 |
Thanks! The new property was released in 8.5.0. |
Thank you @ai for the reviews and release 🙇 |
fixes: #1995