zoukankan      html  css  js  c++  java
  • [NPM] Use package.json variables in npm scripts

    In this lesson we will show that you can leverage values that you already have provided in your package.json file such as the name and version keys. You may want to use these in your npm scripts as you create folders and file names.

    To check all the npm veriable:

    npm run env | grep "npm_package_" | less

    So for example we want is when we do "build" it will create a folder named as npm_package_version's number.

        "build": "npm-run-all build:*",
        "prebuild": "rm -rf public/$npm_package_version",
        "build:html": "pug --obj data.json src/index.pug --out public/$npm_package_version/",
        "build:css": "node-sass src/index.scss | postcss -c .postcssrc.json | cssmin > public/$npm_package_version/index.css",
        "build:js": "mustache data.json src/index.mustache.js | uglifyjs > public/$npm_package_version/index.js"
  • 相关阅读:
    Mysql InnoDB引擎下 事务的隔离级别
    Spring 两大核心 IOC 和 AOP
    java 冒泡排序
    MyBatis 传入List集合作为条件查询数据
    fastfusion运行
    数据集
    工具学习
    三维重建
    Scrivener破解
    博客园设置
  • 原文地址:https://www.cnblogs.com/Answer1215/p/6375544.html
Copyright © 2011-2022 走看看