this is just a simple test to add basic fingerprinting functionality to ember-cli
the replace is currently done in a particularly ugly way and needs to be heavily improved
| // default ember-cli brocfile | |
| var fingerprint = require('broccoli-fingerprint'); | |
| //Example with default options | |
| var tree = app.toTree(); | |
| tree = fingerprint(tree, { | |
| encoding:'utf8' | |
| , separator: '-' | |
| , keepOriginal: false | |
| , extensions: ['js', 'css'] | |
| }); | |
| var replace = require('broccoli-replace'); | |
| var fs = require('fs'); | |
| var path = require('path'); | |
| tree = replace(tree, { | |
| files: [ | |
| 'index.html' | |
| ], | |
| patterns: [{ | |
| match: /app.js/g, | |
| replacement: function(){ | |
| var dir = fs.readdirSync(tree.inputTree.tmpDestDir + "/assets"); | |
| dir = dir.filter(function(e){ | |
| return e.match(/app-.*\.js/); | |
| }); | |
| return dir[0]; | |
| }}, | |
| { | |
| match: /app.css/g, | |
| replacement: function(){ | |
| var dir = fs.readdirSync(tree.inputTree.tmpDestDir + "/assets"); | |
| dir = dir.filter(function(e){ | |
| return e.match(/app-.*\.css/); | |
| }); | |
| return dir[0]; | |
| }} | |
| ] | |
| }); | |
| module.exports = tree; |
| { | |
| "name": "tha", | |
| "version": "0.0.0", | |
| "private": true, | |
| "directories": { | |
| "doc": "doc", | |
| "test": "test" | |
| }, | |
| "scripts": { | |
| "start": "ember server", | |
| "build": "ember build", | |
| "test": "ember test" | |
| }, "repository": "https://github.com/stefanpenner/ember-cli", | |
| "engines": { | |
| "node": ">= 0.10.0" | |
| }, | |
| "author": "", | |
| "license": "MIT", | |
| "devDependencies": { | |
| "ember-cli": "0.0.28", | |
| "originate": "0.1.5", | |
| "broccoli-ember-hbs-template-compiler": "^1.5.0", | |
| "loom-generators-ember-appkit": "^1.1.1", | |
| "express": "^4.1.1", | |
| "body-parser": "^1.2.0", | |
| "broccoli-fingerprint ": "git+https://github.com/ghedamat/broccoli-fingerprint#mattia/preserve-assets-path", "broccoli-replace ": "^0.1.6", | |
| "glob": "^3.2.9" | |
| } | |
| } |