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

feat: support style lang postcss #1259

Merged
merged 1 commit into from
May 14, 2018

Conversation

zyy7259
Copy link
Contributor

@zyy7259 zyy7259 commented May 11, 2018

No description provided.

@zyy7259 zyy7259 force-pushed the support-style-lang-postcss branch from 3c3e7e4 to 7e8ab4b Compare May 11, 2018 07:04
@Akryum
Copy link
Member

Akryum commented May 11, 2018

Hum postcss is already applied to any style block. Not sure this is needed at all.

@zyy7259
Copy link
Contributor Author

zyy7259 commented May 11, 2018

I need to specify the lang attribute of the style block to enable syntax highlight.

Without lang being specified, there will be syntax problem.

image

When I specify the lang with 'postcss', the syntax highlight works fine. But webpack won't able to recognize it.

image

image

here is a test project

git clone [email protected]:zyy7259/test-vue-cli-style-postcss.git
cd test-vue-cli-style-postcss
yarn
yarn build

@zyy7259
Copy link
Contributor Author

zyy7259 commented May 11, 2018

or maybe change createCSSRule('css', /\.css$/) to createCSSRule('css', /\.(p(ost)?)?css$/)?

@zyy7259 zyy7259 force-pushed the support-style-lang-postcss branch from 7e8ab4b to c138d8d Compare May 12, 2018 07:05
@hsxfjames
Copy link
Contributor

A similar discussion is already in vuejs/vetur#506.
At last @blake-newman says:

The issue is solved with explicitness with vue-loader. <style lang="postcss/pcss/sugarcss/sss">

I think it is sensible to keep this feature. In the past, all we need is to install postcss-cssnext and add the custom config in .postcssrc.js.

@zyy7259
Copy link
Contributor Author

zyy7259 commented May 12, 2018

Why did the CI fail :(

@zyy7259 zyy7259 force-pushed the support-style-lang-postcss branch from c138d8d to 037fc28 Compare May 12, 2018 15:01
@yyx990803 yyx990803 merged commit 1037b9c into vuejs:dev May 14, 2018
@octref
Copy link
Member

octref commented May 16, 2018

Thanks again for supporting <style lang="postcss"> in vue-loader. As PostCSS allows plugins to extend the syntax, it's rather hard to support its syntax highlighting and give correct language features. Having at least a lang attribute allows Vetur to not apply CSS grammar / language features to it and cause frustration. In the future when we have better PostCSS support in VS Code or Vetur, I will gradually turn on more supports for PostCSS in Vetur.

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.

5 participants