Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Grunt uses Gruntfile.js configuration for watch and livereload

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Watch angularJS at home on weekends, use the automatic refresh of grunt's livereload for most of the day, post the configuration now, lest you forget it later, there is no problem as long as you follow the configuration step by step

The initial preparation for the environment installation is:

(1): nodeJS, go to the official website to download (href)

(2): then add nodeJS to the global environment variable (after nodeJS is installed, you can use the command npm), refer to (href)

(3): execute npm install grunt- g and npm install-g grunt-cli, one is to install the server-side gurnt and the other is the client-side grunt (just install them anyway), refer to (href)

Step 1: create a new js file called Gruntfile.js

Run the following code

Module.exports = 'package.json'9000'127.0.0.1', livereload: 35729, "html" 35729' * * / * 'default', ["connect", "watch"' grunt-contrib-watch''grunt-contrib-connect' "

2: create a new package.json file and execute npm install directly under cmd (command line) to download all node_module automatically.

Run the following code

{"name": "nono", "version": "0.0.0", "description": "for watch", "main": "Gruntfile.js", "dependencies": {"grunt": "~ 0.4.5", "express": "~ 3.15.2", "grunt-contrib-connect": "~ 0.6.0" "grunt-contrib-watch": "~ 0.5.3"}, "devDependencies": {}, "scripts": {"test": "echo\" Error: no test specified\ "& & exit 1"}, "repository": {"type": "git", "url": "sqqihao.github.com"}, "keywords": ["nono"], "author": "nono" "license": "_ _ MIT__"}

OK, now execute grunt in the current directory, grunt will automatically monitor the changes of all files, and when your files change, all files in html format that you open through 127.0.0.1 will be automatically refreshed.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report