Code Monkey home page Code Monkey logo

gulp's Introduction

gulp工作流demo

文件夹结构说明

dist -- 编译后生成的所有文件(html,js,img)  

libs -- 需要引入的外部库文件  

src -- 编译之前的源文件

    views -- 页面模板文件夹,使用的是pug模板引擎
    js  -- 客户端使用的js文件
    less  -- less文件
    images  -- 图片文件夹

config.js -- 路径配置文件

gulpfile.js -- gulp配置文件

package.json -- 引入的npm工具包和项目说明文件

--

gulp任务说明

clean 清空build文件夹

default 执行默认任务(详细说明看gulp配置文件)

imgmin 图片压缩

pug 编译pug模板为html

less 编译less为css文件

libs 将libs文件夹写入build

scripts 合并、模块打包及压缩js

--

运行

npm install

gulp default

访问http://localhost:8000/html/index.html

--说明
若重启default任务,build文件夹有部分文件未写入需要多重启几次default任务

./libs ./src 目录新增文件也需要重启default

--

更新说明

替换

用 gulp-clean-css 替代 gulp-minify-css

用 del模块 替代 gulp-clean

用 browsersync 替代 gulp-webserver 和 gulp-livereload

因jade模板引擎已经更名为pug
用 gulp-pug 替代 gulp-jade

新增

新增 gulp-html-beautify 输出html美化

新增gulp-bael 编译es6

新智webpack-stream 打包js模块

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.