Original link: http://www.ydcss.com/archives/26
Introduction:
Using Gulp-imagemin compressed picture files (including PNG, JPEG, GIF, and SVG pictures), many people will be installed gulp-imagemin errors, I also looked at a lot of information, do not know why, my practice is to reinstall the error, if you know the problem, Please be sure to tell me. 1, install nodejs/Global installation
12345678910111213
! DOCTYPE HTML> html> head> link rel="stylesheet" href="Css/[email protected] @hash"> /head> body> div>Hello, world ! /div> img src="Img/test.jpg?r[email protected] @hash" alt="" c24>/> /body> /HTML>
4, Configuration Gulpfile.js4.1. Basic use (Add a version number to the page reference URL to clear the page cache)JavaScript
12345678
var
Original link: http://www.ydcss.com/archives/20
Introduction:
Use Gulp-htmlmin compressed HTML, you can compress the page JavaScript, CSS, remove the page spaces, annotations, delete redundant attributes and so on. 1, install nodejs/Global installation gulp/Local installation gulp/create Package.json and gulpfile.js files
1.1,
our unit tests automatically before committing.Code AnalysisWe write JavaScript often have some potential bugs, such as forget to add a semicolon, a variable does not wait, use some JavaScript code analysis tool, can help us to check some common problems. HTML reference JavaScript or CSS files such as we need to use Bower to refer to the front-end JavaScript and CSS third-party libraries, if the version upgrade, add Remove and so on by hand to modify the HTML, first more time-consuming, the sec
tool to run our unit tests automatically before committing.Code AnalysisWe write JavaScript often have some potential bugs, such as forget to add a semicolon, a variable does not wait, use some JavaScript code analysis tool, can help us to check some common problems.HTML referencing JavaScript or CSS filesFor example, we need to use bower and the like to reference the front-end JavaScript and CSS third-party library, then if the version upgrade, add Remove and so on by hand to modify the HTML,
layer after the exposure to users, such as Grunt-contrib-compass. While it may be possible to make the configuration of the plug-in more uniform, it does result in additional understanding costs.
With Gulp your build file was code, not config
Libraries to do things
Plugins is simple and do one thing-most is a line function
Tasks is executed with maximum concurrency
I/O works the IT
Write it in the back.Although
them to the dist/ directory.Default taskgulp.task(‘default‘, function(){ gulp.run(‘lint‘, ‘sass‘, ‘scripts‘); gulp.watch(‘./js/*.js‘, function(){ gulp.run(‘lint‘, ‘sass‘, ‘scripts‘); });});At this point, we create a default task that is based on other tasks. Use .run() methods to correlate and run the tasks defined above, use the .watch() method to listen for file changes in the specified directory, and, when there are changes to the file, run other tasks defined by the callback.Now, back to
() { gulp.src ('./js/*.js ') . Pipe (concat (' all.js ')) . Pipe (Gulp.dest ('./ Dist '). Pipe ( rename (' All.min.js ')). Pipe ( uglify ()) . Pipe (Gulp.dest ('./dist ') ));});The scripts task merges js/ all the JS files in the directory and outputs them to the dist/ directory, and then gulp renames, compresses the merged files, and outputs them to the dist/ directory.Default taskfunction () { gulp.run (' lin
NPM Install Gulp--save-dev
What is Gulp?Gulp is a new generation of front-end project building tools, you can use Gulp and its plug-ins to your project code (LESS,SASS) to compile, you can compress your JS and CSS code, or even compress your pictures, gulp only a smal
action process part of the tool, that is, you need a line of command, do not have to manually create folders and structure.However, you may have to think about it, I do not have the directory structure of each project to be one, what should be done? It is necessary to install different generator depending on the project (http://yeoman.io/generators/), of course, you can also customize a generator, and then publicly for others to use, now we just learn how to use other people's generator , I wil
Before, I introduced to learn to install and configure the front-end Automation Tool gulp, feel gulp indeed than grunt configuration is much simpler, so I decided to further study gulp, went to the Internet to check the data, found that gulp can also automatically add version number, This function is usually when I upd
Introduction to GULP-IMAGEMIN,IMAGEMIN-PNGQUANT-GFW and Gulp-cache : gulp-imagemin plugin is used to compress picture files (including png,jpeg,gif and SVG images). IMAGEMIN-PNGQUANT-GFW plugin is used to compress image files in PNG format in depth. The gulp-cache plugin is used to read cache files. Compressin
Gulp pitfall series (4) -- code conversion of gulp, gulpFinally, I entered the topic. It was just to convert Sass and SCSS code into CSS that I suddenly jumped from the learning path of Sass to the big pitfall of gulp.
Of course, gulp can not only convert Sass, but here we will mention the following conversion:First, c
Introduction to GULP-CLEAN-CSS and Gulp-make-css-url-version:The Gulp-clean-css plugin is used to compress CSS files. The gulp-make-css-url-version plugin is used to give the URL in the CSS file Add version number (build number based on the MD5 of the referenced file). I. gulp
plug-ins available for use:
compiling
Gulp-sass-Compiling the sass into CSS via Libsass
Gulp-ruby-sass-compiling sass into CSS via Ruby Sass
Gulp-compass-compiled into CSS via Ruby sass and Compasssass
Gulp-less-less compiled into CSS.
Gulp-stylus-stylus compiled into CSS.
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.