Vuejs - Browserify - 如何使用LESS变量“@”

时间:2017-03-07 16:44:56

标签: javascript vue.js browserify

我也是vue的新手。

我在较少的文件中遇到变量问题。

我把它们包括在内:

<template id="report_invoice_document" inherit_id="account.report_invoice_document">
    <xpath expr="//div[@class='page']" position="replace">
        <div t-if="o.active_module == account" class="page">
                <!-- Hide Here -->
        </div>
        <div t-else="" class="page">
                <!-- Show Here -->
        </div>
    </xpath>
</template>

..它的确有效!但我明白了:

  

ParseError:意外字符'@'

这是我设置变量和错误来源的方法:

Select top 100 cnb.ndc_id, cnb.contract_num_val, cnb.quote_price, cnb.eff_dt, cnb.end_dt, cnb.discount_pct, cnb.rebate_pct
from [NDC_ATTR] ndc inner join
     CONTRACT_NDC_BRG cnb
     on ndc.attr_val=cnb.NDC_ID
where ndc.field_id = 69 and
      cnb.contract_ndc_brg_id in (select contract_ndc_brg_id
                                  from contract_ndc_brg join
                                       ndc
                                       on contract_ndc_brg.ndc_id = ndc.item_pk
                                  where item_id = @VALUE
                                 );

1 个答案:

答案 0 :(得分:0)

您将需要node-lessify

进入你的项目并执行:

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