NPM Scripts -- onchange parallelshell
- Watch for changes to the styles.scss file and automatically compile it to the css file.
- Run multiple NPM scripts in parallel using parallelshell NPM module.
Watching for Changes and Parallelshell
- First, we install two NPM packages onchange and parallelshell as follows:
npm install --save-dev onchange@3.3.0 parallelshell@3.0.2
- Then, add the following two script items to package.json if you are doing the exercise on a MacOS computer or a Linux computer:
"watch:scss": "onchange \"css/*.scss\" -- npm run scss",
"watch:all": "parallelshell \"npm run watch:scss\" \"npm run lite\""
NPM Scripts Part 1
Objectives and Outcomes
In this exercise, you will learn to set up NPM scripts by modifying the package.json file. At the end of this exercise, you will be able to:
- Watch for changes to the styles.scss file and automatically compile it to the css file.
- Run multiple NPM scripts in parallel using parallelshell NPM module.
Moving JS to Script file
- Create a folder named js and in that folder create a file named scripts.js.
- Open index.html and from this file cut out all the JQuery script that we added to it and move the code to the scripts.jsfile that we created above.
- Then, update the index.html file to include the scripts.js file by adding the following line:
- Add the same line to the scripts block in aboutus.html and contactus.html:
Watching for Changes and Parallelshell
- First, we install two NPM packages onchange and parallelshell as follows:
- Then, add the following two script items to package.json if you are doing the exercise on a MacOS computer or a Linux computer:
- NOTE: If you are doing the exercise on a Windows computer, please use the following two script items instead of the above:
- You will also update the start script as follows:
- Then, type the following at the prompt to start watching for changes to the SCSS file, compile it to CSS, and run the server:
NPM Scripts -- onchange parallelshell的更多相关文章
- NPM Scripts 2 -- rimraf copyfiles imagemin usemin htmlmin uglifyjs
NPM Scripts Part 2 Objectives and Outcomes In this exercise you will learn to build a distribution f ...
- [NPM] Run npm scripts when files change with onchange
In this lesson we will look at how we can setup our npm scripts to execute when the file system has ...
- npm Scripts使用教程【译】
Why npm Scripts? 原文发表于 2016.2.12,原文地址: https://css-tricks.com/why-npm-scripts/ 以下是访客Damon Bauer发布的一篇 ...
- npm scripts 助力前端开发,实时刷新浏览器
用browser-sync或者lite-server来监控文件的改变,当文件改变时,就自动刷新浏览器. 用node-sass来实时编译scss文件. 用parallelshell来异步执行npm sc ...
- npm scripts + webpack 实践经验(React、Nodejs)
最近用Webpack+npm scripts+Mongodb+Nodejs+React写了个后台项目,在用Webpack构建过程中遇到了许多坑,就写出来分享一下. 构建工具五花八门,想当年刚学会Gru ...
- [NPM] Pull out npm scripts into another file with p-s
A technique you might use once you start having lots of npm scripts is to use a node package that al ...
- [NPM] Make npm scripts cross-environment friendly
Unfortunately not all shell commands work across various environments. Two main techniques to suppor ...
- windows下npm scripts不能执行的问题
最近在学webpack为了方便把运行脚本写入package.json文件中,如下: "scripts": { "start": "webpack-de ...
- 5.npm scripts 使用指南
简单介绍 scripts里面的 "start": "node app" npm run start 相当于 node app { "name" ...
随机推荐
- 系列:每日一linux命令(转)
原文:http://www.cnblogs.com/peida/archive/2012/12/05/2803591.html 一. 文件目录操作命令: 1.每天一个linux命令(1):ls命令 2 ...
- HBase 二次开发 java api和demo
1. 试用thrift python/java以及hbase client api.结论例如以下: 1.1 thrift的安装和公布繁琐.可能会遇到未知的错误,且hbase.thrift的版本 ...
- django之自定义软删除Model
软删除 简单的说,就是当执行删除操作的时候,不正真执行删除操作,而是在逻辑上删除一条记录.这样做的好处是可以统计数据,可以进行恢复操作等等. 预备知识 Managers Managers 是djang ...
- NGS中的一些软件功能介绍
1.bowtie 短序列比对工具,blast也是短序列比对工具,速度快,结果易理解. 输入可以是fastq或者fasta文件. 生成比对结果文件sam格式的吧. 2.bwa 转自:https://ww ...
- 推荐系统第4周--- 基于频繁模式的推荐系统和关联规则挖掘Apriori算法
数据挖掘:关联规则挖掘
- C++学习笔记-操作符重载
操作符重载(operator overloading)是一种形式的C++多态,C++将操作符重载扩展到用户自定义的类型,如允许使用+将两个自定义的对象相加,编译器将根据操作数的数目和类型决定使用那种加 ...
- 软工网络15团队作业1——团队组队&展示
一.团队展示 1.队名:想不出队名 2.队员学号(标记组长) 201521123064 郭炜埕 201521123066 郑晓丽 201521123067 廖怡洁 201521123068 包梦榕 2 ...
- 下拉刷新&上拉加载
效果演示 核心codehtml <ion-view view-title="学生list"> <ion-content > <ion-refreshe ...
- 235. Lowest Common Ancestor of a Binary Search Tree(LCA最低公共祖先)
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the ...
- spark程序设计
Spark程序设计—创建RDD:从Scala集合构造成RDD parallelize(a, 3) makeRDD(a, 3) 他俩使用方式一样,只不过名字不一样 Spark程序设计—创建RDD:本地文 ...