简体   繁体   中英

Grunt Package Name Output into Jade File

I wanted to know if it is possible to put the pkg.name and pkg.version into a jade file so I can output a special css file name? I have <% pkg.name %>-<% pkg.version %>.css in the jade but it is only outputting just that, and is not outputting the name and version from the package.json file. Is this possible to do?

In your Gruntfile.js

jade: {
    compile: {
      options: {
        pretty: true,
        data: {name: '<%= pkg.name %>', version: '<%= pkg.version %>'}

In your jade template

p Package: #{name} Version: #{version}. 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM