├── test ├── fixtures │ ├── css0.css │ ├── css1.css │ ├── css2.css │ ├── css3.css │ ├── js1.js │ ├── js2.js │ ├── order.html │ └── index.html ├── expected │ ├── concated.js │ ├── concated.css │ ├── read_order.txt │ ├── order.html │ └── index.html └── dom_munger_test.js ├── .gitignore ├── .travis.yml ├── .jshintrc ├── LICENSE-MIT ├── package.json ├── Gruntfile.js ├── tasks └── dom_munger.js └── README.md /test/fixtures/css0.css: -------------------------------------------------------------------------------- 1 | .css0 { 2 | 3 | } -------------------------------------------------------------------------------- /test/fixtures/css1.css: -------------------------------------------------------------------------------- 1 | .css1 { 2 | 3 | } -------------------------------------------------------------------------------- /test/fixtures/css2.css: -------------------------------------------------------------------------------- 1 | .css2 { 2 | 3 | } -------------------------------------------------------------------------------- /test/fixtures/css3.css: -------------------------------------------------------------------------------- 1 | .css3 { 2 | 3 | } -------------------------------------------------------------------------------- /test/fixtures/js1.js: -------------------------------------------------------------------------------- 1 | function js1(){ 2 | 3 | } -------------------------------------------------------------------------------- /test/fixtures/js2.js: -------------------------------------------------------------------------------- 1 | function js2(){ 2 | 3 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | tmp 4 | -------------------------------------------------------------------------------- /test/expected/concated.js: -------------------------------------------------------------------------------- 1 | function js1(){ 2 | 3 | } 4 | function js2(){ 5 | 6 | } -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.10" 4 | - "0.8" 5 | before_script: 6 | - npm install -g grunt-cli 7 | -------------------------------------------------------------------------------- /test/expected/concated.css: -------------------------------------------------------------------------------- 1 | .css0 { 2 | 3 | } 4 | .css1 { 5 | 6 | } 7 | .css2 { 8 | 9 | } 10 | .css3 { 11 | 12 | } -------------------------------------------------------------------------------- /test/expected/read_order.txt: -------------------------------------------------------------------------------- 1 | ["test/fixtures/css1.css","test/fixtures/css2.css","test/fixtures/css3.css","test/fixtures/js1.js","test/fixtures/js2.js"] -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "curly": true, 3 | "eqeqeq": true, 4 | "immed": true, 5 | "latedef": true, 6 | "newcap": true, 7 | "noarg": true, 8 | "sub": true, 9 | "undef": true, 10 | "boss": true, 11 | "eqnull": true, 12 | "node": true, 13 | "es5": true 14 | } 15 | -------------------------------------------------------------------------------- /test/expected/order.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /test/fixtures/order.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /test/fixtures/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
I no longer have the will to live.
13 |
Sample
14 |
Sample2
15 | 18 | 19 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /test/expected/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CHANGED TITLE 5 | 6 | 7 | 8 | 9 | 10 | 11 | Im being prepended 12 | 13 |
Sample
14 |
Ive been updated via callback
15 | 18 | 19 | 20 |
Made from test/fixtures/index.html
21 |
Im being appended
22 | 23 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Chris Gross 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "grunt-dom-munger", 3 | "description": "Read and manipulate HTML with CSS selectors. Ex. read '} 247 | ] 248 | } 249 | }, 250 | src: 'index.html', 251 | dest: 'dist/index.html' 252 | }, 253 | }, 254 | cssmin: { 255 | main: { 256 | src:'<%= dom_munger.data.cssRefs %>', //use our read css references and concat+min them 257 | dest:'dist/css/app.full.min.css' 258 | } 259 | }, 260 | uglify: { 261 | main: { 262 | src: '<%= dom_munger.data.jsRefs %>', //use our read js references and concat+min them 263 | dest:'dist/js/app.full.min.js' 264 | } 265 | } 266 | }); 267 | ``` 268 | 269 | ## Release History 270 | * v3.4.0 - Update task actions ordering. Reads always first, removes second, all others after. 271 | * v3.3.0 - All task actions can now be arrays for multiple actions per type. 272 | * v3.2.0 - Added second `file` argument to callback (#15). 273 | * v3.1.0 - Prefix and suffix options added. Fixes for issues #8, #10, and #11. 274 | * v3.0.0 - Removed `jsdom` engine as `cheerio` is as good without needing contextify. 275 | * v2.0.0 - Moved to `cheerio` engine. Upgraded jquery to v2. 276 | * v1.0.1 - `remove` moved to the second to last operation performed (only `callback` is later). 277 | * v1.0.0 - Read task modified to write values to `dom_munger.data` rather than to write directly to a task config. 278 | * v0.1.0 - Initial release. 279 | --------------------------------------------------------------------------------