Combat Environment Build Gulp

Source: Internet
Author: User
Tags type null


Actual environment construction

1.1 Environment
Operating Environment Nodejs
Compile Scss,js with Gulp automation, etc.
Using Bower to manage dependency plugins
Using Requirejs as the module loader
Using bootstrap CSS as a style frame
Dependent Jquery,jquery-ui two libraries


1.2 Project directory
Node_modules for dependent module files
. BOWERRC is a bower configuration file that contains the module installation directory configuration
Bower.json for Bower configuration file, including dependent modules, etc.
Gulpfile.js for Gulp Task profiles
Package.json for the program configuration file, including NPM dependency module, etc.
Lib is a dependent file in Bower.json dependencies


-----------------------------------------------------------

-----------------------------------------------------------


1.node Environment

2. Install git

3. CD project directory in Git

Execute inside the cmd

Bower Install

Or

NPM Install-g Bower


Bower Init

Then enter information such as name

Road Pass

There will be more Bower.json when the project directory is installed.

!! Bower Init
-----------------------------------------------------------

Create configuration Accessory configuration Bowe download directory (executed in git)
Type NULL>.BOWERRC

0.

{
"Directory": "Lib"
}


Then inside the CMD CD to the project directory and then Bower Init (before skipping if executed)

-----------------------------------------------------------

4. Download js behind the--save-dev to add

Bower install jquery bootstrap Requirejs jquery-ui--save-dev


(save adds this will have JSON configuration item version information)
-----------------------------------------------------------

5 Global Installation Gulp
Gulp.js is an automated build tool that developers can use to automate common tasks during the project development process.
Gulp.js is built on node. JS and leverages the power of the node. JS stream to quickly build projects

NPM Install Gulp-g
Or
CNPM Install Gulp-g

No dev here.

CNPM Install Gulp-g

This suggestion is loaded with cmd

Must be installed globally!!!


Gulp-v


Note here that the installation is successful and there will be two version numbers

Execution: Gulp

-----------------------------------------------------------


Scss

Sass

n a CSS into a dist inside


-----------------------------------------------------------

Configure recommended CMD

First
CNPM Init


Installation

CNPM Install Gulp-connect--save-dev

CNPM Install Gulp-webserver--save-dev


CNPM Install Gulp-sass--save-dev


CNPM Install Gulp-minify-css--save-dev


CNPM Install Gulp-cssimport--save-dev


CNPM Install Gulp-concat--save-dev


CNPM Install gulp-notify--save-dev


CNPM Install Gulp-livereload--save-dev

They're all loaded.

Package.json This file is written to the configuration file

Gulp

CNPM Install Gulp-cssimport--save-dev

-----------------------------------------------------------
Local Gulp not found in F:\demoxmxh
[16:02:54] Try running:npm Install Gulp


Half of the building failed, let go.


Build two


A front-desk service behind the scenes

Node_modules/gulp/bin/gulp.js

36.22


At Object.module._extensions. Node (module.js:681:18)
At Module.load (module.js:565:32)
At Trymoduleload (module.js:505:12)
At Function.module._load (Module.js:497:3)
At Module.require (module.js:596:17)
At require (INTERNAL/MODULE.JS:11:18)
At Module.exports (F:\severdemo\node_modules\[email protected] @node-sass\lib\binding.js:19:10)
At object.<anonymous> (F:\severdemo\node_modules\[email protected] @node-sass\lib\index.js:14:35)
At Module._compile (module.js:652:30)
At Object.module._extensions. JS (module.js:663:10)

[Email protected] @node-sass\vendor\win32-x64-57\binding.node is not a valid WIN32 AP

Sass's Problem


1:11 58

Gulp

Error


https://www.zhihu.com/question/33552192


' sudo npm install gulp-g ' just fine (global installation, although can solve your problem, but generally I do not use it). It's a good idea to first create the Package.json file and then, as you can see, ' npm Install Gulp--save-dev ', which installs the gulp into the Node_modules directory under the current directory. At the same time a gulp executable will be installed under the./node_modules/.bin. At this point you execute:/node_modules/.bin/gulp. This approach is better than a global installation because the version of Gulp used is only relevant to the current project. If you feel that each time you enter./node_modules/gulp complex, then you have to add a scripts paragraph in Package.json such as {"Build": "Gulp"}, and then each time you execute the NPM build in the project directory. When NPM runs the script, it automatically finds the corresponding executable file under./node_modules/.bin.

Shen Yu
Links: https://www.zhihu.com/question/33552192/answer/56803638
Source: Know
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.


----------------------------------------


NPM Install Gulp--save-dev


Chunlei
Links: https://www.zhihu.com/question/33552192/answer/65615013
Source: Know
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.

I was also just trying gulp (1th day), met the same problem, said the solution. I am in the ubuntu14.04, different circumstances may not be exactly the same. The global installation of sudo npm install gulp-g is not supported because Post Gulp will automatically introduce project-related support packages, and if the global installation gulp, these support packages are all installed under/usr/local/lib/node_modules/and are not conducive to management, May easily cause conflict. You should use the $NPM install--save-dev Gulp in your project, gulp the installed path is node_modules under the project, use the command when Glup is executed: $node _modules/gulp/bin/gulp.js If you find this cumbersome, you can use the LN command to create a shortcut under the project path: $LN-S node_modules/gulp/bin/gulp.js gulp$./gulp. ============= Shameless dividing line ============= after 1 months, again to gulp further systematic study (this is also the second day of contact gulp). Here's a look at the strange problems with the global installation, as follows: According to the article Nodejs mentioned in the Node_path, I set the Node_path and NPM prefix, set up, after the strange thing happened. Executing gulp within the project path, the system still prompts for NPM install Gulp, which means that the installation is still required within the project, even if the execution of $/usr/local/lib/node_modules/gulp/bin/gulp.js still requires a local installation. It's not surprising, oddly enough, that I further try to find that when Gulp is called in the/usr/local/lib path, the system prompts "Gulpfile file not found", indicating that the path has been recognized, and that the local installation of Gulp is still required in the outer layer of the path. Ask, what the hell is this?


CNPM Install--save-dev Gulp

NPM Install--save-dev Gulp


Lodash._basecopy

CNPM Install Gulp-livereload--save-dev

NPM Install Gulp (this will cause problems if you do not have global install global installation)

Real TM, Gulp. Cannot be installed globally

----------------------------------------

Https://stackoverflow.com/questions/27431187/cannot-find-module-lodash

Combat Environment Build Gulp

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.