Module.exports = function (grunt) {Grunt configuration I will not be the same as the crossing network on the OKI'll introduce the grunt dependency plugin Grunt-contrib-requirejsSpecially packaged REQUEIRJS projects.Grunt.initconfig ({ Here the Requirejs configuration and requeirjs.config to distinguish, that is the REQ
The most recent project in the front and back is completely decoupled, with grunt management of the project. This can lead to a problem: cross-domain issues occur when the front-end interface is not on a server because it is being called at development time. However, it is not possible to implement a true cross-domain in either JSONP or Cros, as the project is actually published under the same server.At this time our
1. Grunt EffectEnables repetitive work such as compression, compilation, unit testing, etc.2, need to install the software First step: Get Nodejs package from official website, double click to install (under Windows)Step two: Open cmd command line, execute command ' node-v ', can output version number, indicating node is installed properlyStep three: On the cmd command line, enter the installation command, respectively, to install
What is Gruntmate?
A grunt based project management visualization tool (still not sure what grunt is?) Can Google a bit to know! )
What are the functions of gruntmate?
Easy management of Grunt based projects
Facilitate unified management of grunt Plug-ins
Provides visual start, stop
1. Official websiteNodejs official website https://nodejs.org/en/Grunt official website http://gruntjs.com/Grunt plug-in home http://gruntjs.com/plugins2. PrefaceThe previous period of time accidentally upgraded WIN10 (360), various kinds of problems do not adapt to a variety of software bugs, the final decision to fall back to Win7, and then sad to find the system has problems, open in the he opened after
When configuring Grunt tasks, wildcard support and detailed description of dynamically generated file names, grunttask
Copy: {// This is one of the Target dests: {expand: true, cwd: '
Wildcard support: supported by the node-glob library built in node. js. These can be used in the various file configurations mentioned above.
1. * match any character/
2 ,? Match a single character,/
3. ** match any character, including/, so it is used in the directo
business; All types of module loaders basically perform the above business (AMD,CMD,KMC ... ); The module code loading in the browser environment is different from the parsing of the module code load in the node environment;3: Code Merge: Before the Web front-end static files must be done before the optimization means: Reduce the size of the code file, reduce the HTTP request;The means to reduce the volume of code is compressed code (commonly known as ugly), in the node environment has a lot of
Ext represents the file suffix name after processing. Replace all generated target file suffixes with this property
Extdot:first: Indicates that the suffix name begins after the first point after the filename; Last: Indicates that the suffix name starts after the final point after the filename
Flatten: Deletes the path portion of all generated dest, the value is Boolean (True, false) to specify whether to keep the file directory structure, true is to keep the file directory
Rename a functio
1. OverviewGrunt is also a task runners based on JavaScript (using NPM) technology. Task runners is an application, or it is a task tool. This chapter continues with the previous article on the basis of the project to demonstrate!2. Compile Less2.1 Create less fileCreate the Lesses folder in the root directory of the "vnext.webstartertemplate" project first. Under which two less files are created:Color.less Code:// color style definition @bg-color-red: #ff0000;Site.less Code:Embed color.less sty
First install the required plug-ins:
Nodejs Installation
Grunt Installation
Grunt-contrib-Watch: NPM install grunt-contrib-watch-save-Dev
Because this is to introduce livereload to listen for your modifications to the file, a server is required to implement communication between the browser and the service,
Therefore, Apache can be used for implementation. P
Grunt tutorial 2
Concat plugin
Concat is a common plug-in used in grunt for file connection. For example, if you write a class library, there are three modules, such:
A. js
B. js
C. js
When your project is ready for release, you may need to combine these three modules into a large module, all. js. This can reduce HTTP requests and increase the page response speed.
If we need to connect these three modules a
1> first, you must have a nodejs environment, at least version 0.8.0;
2>. Go to the project folder:
> NPM install-G grunt-cli> NPM init # generate a basic package. the devdependencies Plugin in the JSON file is configured by yourself> Add gruntfile. JS # [copy one copy]> NPM install grunt-save-dev # [install the grunt plug-in] is different from
---restore content starts---Webpack and Gulp, grunt in fact there is nothing comparable, it can be seen as a module Packer, through the analysis of your project structure, to find JavaScript modules and other browsers can not directly run the expansion of the language (Scss,typescript, etc.), It is converted and packaged into the appropriate format for use by the browser. Gulp/grunt is a tool that optimizes
Today, I fork a small demo (https://github.com/cowboy/jquery-tiny-pubsub) of a grunt project written by someone on GitHub, mainly to learn about the use of grunt, According to the official document (http://www.gruntjs.org/docs/getting-started.html), step by step to execute, first of all, the project needs to use a few grunt plug-ins, the other installation is not
2014-08-25Http://www.w3cplus.com/preprocessor/nodejs-and-grunt-compile-sass-to-css.htmlInstallation of grunt Sass support, including Grunt watch BoostrapsGruntfile.js,package.json,Direct test to the new project directory to adjust the use, run the NPM install dependency package, you can cut unnecessary a. Integration method 1.https://github.com/gruntjs/
JSHINT:A Static Code Analysis tool for JavaScript (JavaScript verifier). It has many kinds of installation methods. http://jshint.com/install/. This article mainly describes the installation method as a grunt plugin.1, installation JshintInstallation Prerequisites: node and grunt need to be installed. http://blog.csdn.net/wangfupeng1988/article/details/46418203①windows Platform: npm install
Once the GRUNT-CLI is complete, you can install grunt for each item. 1. First copy the Package.json and Gruntfile.js to the project (PS: These two files are required when each project turns grunt) 2.cmd go to the project directory and execute "NPM install grunt--save-dev" (PS: This step is used to
--Installation Nodejsinstall Nodejs under Windows, click here, the other system will install the software, Nodejs will be installed, Nodejs installation is very simple.--Installation Gruntusing NPM Global installation, command:npm install-g grunt-cli--Test compression-NPM initNPM init create Package.json filejoin the dependent package. Package.json Content{ "name": "Demo1", "version": "1.0.0", "description": "", "main": "Index.js", "scripts": {
Module.exports =function(grunt) {//Livereload The default port number, you can also change to the port number you want varLrport = 35729; //using the Connect-livereload module, generate a script with Livereload // varLrsnippet = require (' Connect-livereload ')) ({port:lrport}); //with middleware (middleware), you must close the Livereload browser plugin varLrmiddleware =function(Connect, options) {return [ //inject the script
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.