Advanced-Gulp-WordPress 项目教程

Advanced-Gulp-WordPress 项目教程

Advanced-Gulp-WordPressAn Advanced Gulp Workflow for WordPress themes. [🚨Deprecated in favour of WPGulp https://github.com/ahmadawais/WPGulp | STAR/FORK WPGulp instead]项目地址:https://gitcode.com/gh_mirrors/ad/Advanced-Gulp-WordPress

1. 项目的目录结构及介绍

Advanced-Gulp-WordPress/
├── assets/
│   └── ...
├── 404.php
├── LICENSE
├── README.md
├── archive.php
├── bower.json
├── comments.php
├── footer.php
├── functions.php
├── gulpfile.js
├── header.php
├── index.php
├── package.json
├── page.php
├── screenshot.png
├── search.php
├── sidebar.php
└── single.php
  • assets/: 存放项目的静态资源文件,如图片、CSS、JavaScript等。
  • 404.php: 自定义404页面。
  • LICENSE: 项目许可证文件。
  • README.md: 项目说明文档。
  • archive.php: 存档页面模板。
  • bower.json: Bower包管理配置文件。
  • comments.php: 评论模板。
  • footer.php: 页脚模板。
  • functions.php: 主题功能和设置。
  • gulpfile.js: Gulp任务配置文件。
  • header.php: 头部模板。
  • index.php: 主页模板。
  • package.json: Node.js包管理配置文件。
  • page.php: 页面模板。
  • screenshot.png: 主题截图。
  • search.php: 搜索结果页面模板。
  • sidebar.php: 侧边栏模板。
  • single.php: 单篇文章模板。

2. 项目的启动文件介绍

项目的启动文件主要是 gulpfile.js,它负责配置和运行Gulp任务。以下是 gulpfile.js 的主要内容:

// gulpfile.js 主要内容示例
const gulp = require('gulp');
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');

// SASS 编译任务
gulp.task('sass', function () {
    return gulp.src('assets/scss/**/*.scss')
        .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
        .pipe(autoprefixer({
            browsers: ['last 2 versions'],
            cascade: false
        }))
        .pipe(gulp.dest('assets/css'));
});

// 默认任务
gulp.task('default', ['sass'], function () {
    gulp.watch('assets/scss/**/*.scss', ['sass']);
});

3. 项目的配置文件介绍

项目的配置文件主要包括 bower.jsonpackage.json

bower.json

bower.json 用于管理前端依赖包,示例如下:

{
  "name": "advanced-gulp-wordpress",
  "version": "1.0.0",
  "authors": [
    "Ahmad Awais <me@ahmadawais.com>"
  ],
  "description": "An Advanced Gulp Workflow for WordPress themes",
  "main": "gulpfile.js",
  "license": "GPL-2.0",
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "test",
    "tests"
  ],
  "dependencies": {
    "jquery": "~2.1.4"
  }
}

package.json

package.json 用于管理Node.js依赖包,示例如下:

{
  "name": "advanced-gulp-wordpress",
  "version": "1.0.0",
  "description": "An Advanced Gulp Workflow for WordPress themes",
  "main": "gulpfile.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Ahmad Awais",
  "license": "GPL-2.0",
  "devDependencies": {
    "gulp": "^3.9.1",
    "gulp-sass": "^2.3.2",
    "gulp-autoprefixer": "^3.1.1"
  }
}

以上是 Advanced-Gulp-WordPress 项目的

Advanced-Gulp-WordPressAn Advanced Gulp Workflow for WordPress themes. [🚨Deprecated in favour of WPGulp https://github.com/ahmadawais/WPGulp | STAR/FORK WPGulp instead]项目地址:https://gitcode.com/gh_mirrors/ad/Advanced-Gulp-WordPress

  • 4
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

傅隽昀Mark

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值