Gulp4 前端自动化工作流配置

栏目: 编程工具 · 发布时间: 6年前

内容简介:随着最近把 nodejs 从于是趁此机会,把 Gulp 升级为现已经发布至 Github 和 NPM 作为不定期维护的一个项目。关于后续更新和维护情况,请关注本项目的:

随着最近把 nodejs 从 8.x 升级到了 10.x ,发现 Gulp3.x 早已经不能兼容新版的 node,并且环境中的部分依赖,也已经被淘汰。

于是趁此机会,把 Gulp 升级为 4.x 版本,并把整个环境重新改造了一下。

现已经发布至 Github 和 NPM 作为不定期维护的一个项目。关于后续更新和维护情况,请关注本项目的: GitHubNPM

简介(Introduction)

简单实用的前端自动化工作流配置,基于 Gulp4.x

Simple and practical front-end automated workflow configuration based on Gulp4.x

特性(Features)

  • SASS (CSS preprocessor)
  • 图像压缩和转Base64 (Images compress & save base64 image)
  • JS压缩 (JavaScript compressor)
  • 热加载 (Hot reload)
  • 一套环境多项目共存 (Multi-Project Builds)

目录结构(Directory structure)

+ project_file_name                 // Project folder(Example)
    + Build                         // Production folder(Output floder)
        - etc...
    + dist                          // Pevelopment folder(Output floder)
        - etc...
    + dist__test                    // Test folder(Output floder)
        - etc...
    + src                           // Source code
        - images                    // Image folder
        - js                        // Script folder
        - lib                       // CSS/JS library
        - scss                      // Style folder
        - project.config.js         // Project custom config
- .gitignore                        // Exclude files from git
- gulp.config.js                    // Gulp custom config
- gulpfile.js                       // Gulp config
- package.json                      // Dependency & Module list
- README.md                         // Documentation
- yarn.lock                         // Yarn

环境要求(Pre Required)

如果你已经全局安装了 gulp 请先删除旧版本后再安装

If you've previously installed gulp globally, please remove the old version

$ npm rm --global gulp
# or
$ yarn global remove gulp

全局安装 gulp-cli

Install the gulp command line utility

$ npm install --global gulp-cli
# or
$ yarn global add gulp-cli

安装方式(Installation)

# 安装 - Using npm or yarn
$ npm i ublue-gulp-config
# or
$ yarn add ublue-gulp-config
# 安装依赖 - Install dependency
$ npm install
# or
$ yarn install

使用方法(Used)

# 项目初始化 - Project initialization
$ gulp init

# 环境启动 - Start it
$ gulp

环境切换(Using environment variables)

# 发布测试环境 - Build for test environment
$ gulp init --test

# 发布生产环境 - Build for production environment
$ gulp init --build

# 清理生产目录 - Clean up development or production
$ gulp clean

# 清理指定环境目录 - Clean up the specified environment directory
$ gulp clean --test

开源许可(License)

MIT


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

C++数值算法(第二版)

C++数值算法(第二版)

William T.Vetterling、Brian P.Flannery、Saul A.Teukolsky / 胡健伟、赵志勇、薛运华 / 电子工业出版社 / 2005年01月 / 68.00

本书选材内容丰富,除了通常数值方法课程的内容外,还包含当代科学计算大量用到的专题,如求特殊函数值、随机数、排序、最优化、快速傅里叶变换、谱分析、小波变换、统计描述和数据建模、常微分方程和偏微分方程数值解、若干编码算法和任意精度的计算等。 本书科学性和实用性统一。每个专题中,不仅对每种算法给出了数学分析和比较,而且根据作者的经验对算法做出了评论和建议,并在此基础上给出了用C++语言编写的实用程......一起来看看 《C++数值算法(第二版)》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具