grunt-replace-files v1.0.1
grunt-replace-files
基于grunt的文本内容替换组件.
Getting Started
This plugin requires Grunt.
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-replace-files --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-replace-files');
The "grunt-replace-files" task
Overview
In your project's Gruntfile, add a section named regexReplace
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
regexReplace: { default: { options: { //在文本中使用下面的正则替换内容( 例:把'="lib/'正则匹配到的内容替换成字符串'="LIB/' ) regex: { '="lib/': '="LIB/', '="scripts/': '="JS/', '="styles/': '="CSS/', '="images/': '="IMG/' } }, files: { expand: true, cwd: 'data/src', src: '{,/}.html', dest: 'data/dest', ext: '.html' } } }, })
License
Copyright (c) 2015 李浩. Licensed under the MIT license.