diff --git a/.editorconfig b/.editorconfig
index b4458e1..e8df3ce 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,17 +1,16 @@
-# http://editorconfig.org
root = true
[*]
indent_style = tab
-indent_size = 4
+indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
-[*.md]
-trim_trailing_whitespace = false
+[package.json]
+indent_style = space
+indent_size = 2
-[test/fixtures/*]
-insert_final_newline = false
+[*.md]
trim_trailing_whitespace = false
diff --git a/.gitattributes b/.gitattributes
index 2125666..176a458 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1 +1 @@
-* text=auto
\ No newline at end of file
+* text=auto
diff --git a/.gitignore b/.gitignore
index 99787f8..fd4f2b0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,2 @@
+node_modules
.DS_Store
-node_modules/
-temp/
-coverage
diff --git a/.jshintrc b/.jshintrc
index a9ccf70..027ef9d 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -1,21 +1,14 @@
{
- "node": true,
- "esnext": true,
- "bitwise": true,
- "camelcase": true,
- "curly": true,
- "eqeqeq": true,
- "immed": true,
- "indent": 4,
- "latedef": true,
- "newcap": true,
- "noarg": true,
- "quotmark": "double",
- "regexp": true,
- "undef": true,
- "unused": true,
- "strict": true,
- "trailing": true,
- "smarttabs": true,
- "white": true
+ "node": true,
+ "esnext": true,
+ "bitwise": true,
+ "camelcase": true,
+ "curly": true,
+ "immed": true,
+ "newcap": true,
+ "noarg": true,
+ "undef": true,
+ "unused": "vars",
+ "strict": true,
+ "mocha": true
}
diff --git a/.npmignore b/.npmignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/.npmignore
@@ -0,0 +1 @@
+node_modules
diff --git a/.travis.yml b/.travis.yml
index 0b981a1..dedfc07 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,6 @@
+sudo: false
language: node_js
node_js:
- - '0.8'
+ - 'iojs'
+ - '0.12'
- '0.10'
-after_script:
- - npm run coveralls
diff --git a/LICENSE b/LICENSE
index bd80a1a..6f6b623 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,20 +1,21 @@
-Copyright 2014 Raúl
+The MIT License (MIT)
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
+Copyright (c) raulghm
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/README.md b/README.md
index 2166d1f..8ffdfa9 100644
--- a/README.md
+++ b/README.md
@@ -4,12 +4,13 @@
-
> gulp-wp-rev plugin for [gulp](https://github.com/wearefractal/gulp)
-> Revisioning JS and CSS to scripts.php file on wordpress assets
+Revisioning CSS/JS appending a hash in you assets of wordpress theme.
+
+`styles.css?ver=1` → `styles?ver=bd0622b828f9346876088cd617566fa5`
-Alternative gulpjs version for `grunt-wp-version` of https://github.com/roots/roots
+
## Usage
@@ -22,19 +23,18 @@ npm install --save-dev gulp-wp-rev
Then, add it to your `gulpfile.js`:
```javascript
-var rev = require("gulp-wp-rev");
+var wpRev = require('gulp-wp-rev');
gulp.task('rev', function () {
- gulp.src('lib/scripts.php')
- .pipe(rev({
- css: "assets/css/main.min.css",
- cssHandle: "roots_main",
- js: "assets/js/scripts.min.js",
- jsHandle: "roots_scripts"
- }))
- .pipe(gulp.dest('lib'));
+ gulp.src('./wp-content/themes/raulghm-theme/lib/scripts.php')
+ .pipe(wpRev({
+ css: 'src/styles/styles.css',
+ cssHandle: 'my_assets',
+ js: 'src/scripts/scripts.js',
+ jsHandle: 'my_assets'
+ }))
+ .pipe(gulp.dest('./wp-content/themes/raulghm-theme/lib'));
});
-
```
## API
@@ -64,16 +64,4 @@ Name used as a handle for the javascript.
## License
-[MIT License](http://en.wikipedia.org/wiki/MIT_License)
-
-[npm-url]: https://npmjs.org/package/gulp-wp-rev
-[npm-image]: https://badge.fury.io/js/gulp-wp-rev.png
-
-[travis-url]: http://travis-ci.org/raulghm/gulp-wp-rev
-[travis-image]: https://secure.travis-ci.org/raulghm/gulp-wp-rev.png?branch=master
-
-[coveralls-url]: https://coveralls.io/r/raulghm/gulp-wp-rev
-[coveralls-image]: https://coveralls.io/repos/raulghm/gulp-wp-rev/badge.png
-
-[depstat-url]: https://david-dm.org/raulghm/gulp-wp-rev
-[depstat-image]: https://david-dm.org/raulghm/gulp-wp-rev.png
+MIT © [raulghm](https://github.com/raulghm)
diff --git a/example/demo.gif b/example/demo.gif
new file mode 100644
index 0000000..393edc0
Binary files /dev/null and b/example/demo.gif differ
diff --git a/example/gulpfile.js b/example/gulpfile.js
new file mode 100644
index 0000000..981c7c7
--- /dev/null
+++ b/example/gulpfile.js
@@ -0,0 +1,29 @@
+'use strict';
+
+var gulp = require('gulp');
+var runSequence = require('run-sequence');
+var wpRev = require('gulp-wp-rev');
+
+gulp.task('rev', function () {
+ gulp.src('./wp-content/themes/raulghm-theme/lib/scripts.php')
+ .pipe(wpRev({
+ css: 'src/styles/styles.css',
+ cssHandle: 'my_assets',
+ js: 'src/scripts/scripts.js',
+ jsHandle: 'my_assets'
+ }))
+ .pipe(gulp.dest('./wp-content/themes/raulghm-theme/lib'));
+});
+
+gulp.task('build', function (callback) {
+ runSequence(
+ 'rev',
+ function (error) {
+ if (error) {
+ console.log(error.message);
+ } else {
+ console.log('Build finished successfully :)');
+ }
+ callback(error);
+ });
+});
diff --git a/example/package.json b/example/package.json
new file mode 100644
index 0000000..77a413c
--- /dev/null
+++ b/example/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "example",
+ "version": "1.0.0",
+ "description": "example",
+ "main": "gulpfile.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1",
+ "build": "gulp build"
+ },
+ "author": "raulghm",
+ "license": "MIT",
+ "devDependencies": {
+ "gulp": "^3.9.0",
+ "gulp-wp-rev": "0.0.1",
+ "run-sequence": "^1.1.5"
+ }
+}
diff --git a/example/src/scripts/scripts.js b/example/src/scripts/scripts.js
new file mode 100644
index 0000000..6a9a4d7
--- /dev/null
+++ b/example/src/scripts/scripts.js
@@ -0,0 +1 @@
+console.log('Más vale código en mano que líneas volando');
diff --git a/example/src/styles/styles.css b/example/src/styles/styles.css
new file mode 100644
index 0000000..af1058e
--- /dev/null
+++ b/example/src/styles/styles.css
@@ -0,0 +1,3 @@
+body {
+ background: #bbb;
+}
diff --git a/example/wp-content/themes/raulghm-theme/lib/scripts.php b/example/wp-content/themes/raulghm-theme/lib/scripts.php
new file mode 100755
index 0000000..81bf5cd
--- /dev/null
+++ b/example/wp-content/themes/raulghm-theme/lib/scripts.php
@@ -0,0 +1,19 @@
+
+
+
+=0.10.0"
+ },
+ "scripts": {
+ "test": "mocha"
+ },
+ "files": [
+ "index.js"
+ ],
"keywords": [
"gulpplugin",
"wordpress"
@@ -14,32 +30,13 @@
"cache",
"expire",
"static",
- "asset",
"assets"
],
- "homepage": "https://github.com/raulghm/gulp-wp-rev",
- "bugs": "https://github.com/raulghm/gulp-wp-rev/issues",
- "author": {
- "name": "Raul Hernandez",
- "email": "raulghm@gmail.com",
- "url": "https://github.com/raulghm"
- },
- "main": "./index.js",
- "repository": {
- "type": "git",
- "url": "git://github.com/raulghm/gulp-wp-rev.git"
- },
"dependencies": {
- "through2": "*",
- "gulp-util": "~2.2.0"
- },
- "engines": {
- "node": ">=0.8.0",
- "npm": ">=1.2.10"
+ "gulp-util": "^3.0.1",
+ "through2": "^0.6.3"
},
- "licenses": [
- {
- "type": "MIT"
- }
- ]
+ "devDependencies": {
+ "mocha": "*"
+ }
}
diff --git a/test.js b/test.js
new file mode 100644
index 0000000..b6a3d13
--- /dev/null
+++ b/test.js
@@ -0,0 +1,22 @@
+'use strict';
+var assert = require('assert');
+var gutil = require('gulp-util');
+var wpRev = require('./');
+
+it('should ', function (cb) {
+ var stream = wpRev();
+
+ stream.on('data', function (file) {
+ assert.strictEqual(file.contents.toString(), 'unicorns');
+ });
+
+ stream.on('end', cb);
+
+ stream.write(new gutil.File({
+ base: __dirname,
+ path: __dirname + '/file.ext',
+ contents: new Buffer('unicorns')
+ }));
+
+ stream.end();
+});