On Vant's custom subject matter

Source: Internet
Author: User
Tags postcss

Recently, when learning the Vant UI library, I found that the website was not very detailed about the content of the custom theme.

To quite a little white I was in the learning process caused a lot of trouble. Read a lot of information, found that the online description of the introduction of very little. Decided to write down this article

Let's take a look at the instructions on the official website:

 

First let us use postcss-theme-variables this plug-in, but did not say how to use, the blue Word looks like a link, click to see the discovery is a bunch of English, it looks like the use of yarn, as if it does not seem to be used;

So since it is postcss plug-in, you should first know how the POSTCSS plug-in is generally used, and then I did a review found a piece of article vue How to use Postcss 79654656
Follow the link above to install it.

And then back to the official website said it is necessary to write down the postcss.config.js in the configuration, found that there is no such configuration file, the new one found hair with no.

Instead, I found that some of the CSS problems introduced in Main.js

You can see that the viewer doesn't recognize & this syntax

Finally, I held it in my heart to try to write him into the automatically generated. postcssrc.js file

Module.exports = {  "plugins":  [      require (' Postcss-theme-variables ') ({          vars: {              red: ' #F60 ',              Gray: ' #CCC ',              Blue: ' #03A9F4 '          },          prefix: ' $ '      }),      require (' Precss ') (),      require (' Postcss-calc ') (),      require (' Autoprefixer ') ({          browsers: [' Android >= 4.0 ', ' IOS >= 7 ']}      )  ]}

And then found that the compilation was successful, the CSS with the $ symbol was compiled successfully.

Although the color overlay doesn't seem to work. However, the same effect can be achieved by directly modifying the values of the variables in the var.css. For the time being, no better way to look forward to the completion and help of the great God

On Vant's custom subject matter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.