Enable vendor prefix autocomplete in CSS files in Visual Studio Code

余生颓废 提交于 2020-12-13 07:37:39

问题


How can I tell VSCode to automatically add vendor prefixed style properties when adding a property without vendor prefixes added in CSS files (not SASS nor LESS files)?


回答1:


I have been using css-auto-prefix plugin. For most of the CSS3 properties it works fine. Though still in beta version, improvements are going on.You should try this one, it saves time and energy.

Perform following steps to install css-auto-prefix plugin in vscode.

  1. Open VS Code.
  2. Click Ctrl+Shift+X(on windows) or click on extensions icon on the left most panel.
  3. A search box will appear. Simply type css-auto-prefix.
  4. Install and Reload and you are good to go.

css-auto-prefix




回答2:


I have been using VS Code Autoprefixer plugin. It supports CSS, SCSS and SASS.

Select all CSS, then hit command pallet, then hit AutoPrefixer: Run.

If nothing happens, then add this below section in settings.json for Autoprefixer -

"autoprefixer.options": {
    "browsers": [
        "last 4 versions",
        "ie >= 9",
        "> 5%"
    ]
}

After that select all CSS, then hit command pallet, then hit AutoPrefixer: Run and it will work.




回答3:


You can install "Auto prefix" or "Css Auto Prefix" Extension in your vs code but I am not quite sure if it would be ok to write our own snippest for the prefix maybe that way it will be more customizable.

But we also can always install "auto prefix" via NPM a Node package manager.



来源:https://stackoverflow.com/questions/50928781/enable-vendor-prefix-autocomplete-in-css-files-in-visual-studio-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!