2017-03-07 86 views
1

我也是vue的新手。Vuejs - Browserify - 如何使用LESS變量「@」

我在我的少文件中遇到變量問題。

我包括他們像這樣:

require("./colors.less"); 

..和它的作品!但我得到:

ParseError: Unexpected character '@'

這是我如何設置變量和錯誤的來源:

//colors.less 
@aqua: #5CBFBF; 
@aquadark: #1C939B; 
@mediumgray :#d1d2ce; 
@blue  :#376784; 

回答

0

您將需要節點lessify

cd到你的項目,並做到:

npm install node-lessify 

然後在你的項目的根目錄找到你的package.json。

作如下補充:

"scripts": { 
    "node-lessify" :"node-lessify src/path-to-your-less-file.less > bundle.js", 
    //....leave what is here already alone, don't forget the trailing comma 
    }, 
    "browserify": { 
    "transform": [ 
     "node-lessify", 
    //....leave what is here already alone, don't forget the trailing comma 
    ] 
    }, 
    "devDependencies": { 
    "node-lessify":"0.1.4", 
    //....leave what is here already alone, don't forget the trailing comma