Skip to content

Latest commit

 

History

History
71 lines (57 loc) · 1.78 KB

README.md

File metadata and controls

71 lines (57 loc) · 1.78 KB

bowerz

test bower components in kraken 1.0

Requirements

Expect bower components which (for component named matt):

  • has single layer template directory: matt/templates/*.dust
  • one or more locale based directory endpoints matt/locales/{CC}/{lc}/*.properties where CC=country code and lc=language code

grunt-contrib-symlink task needs to:

  • symlink matt/templates/*.dust -> public/templates/components/matt/*.dust
  • symlink matt/locales/{CC}/{lc}/*.properties -> locales/{CC}/{lc}/components/matt/*.properties

Install app and run bower task

$ git clone <this repo>
$ cd bowerz
$ npm install
$ bower install

Note, before you run the symlink task, there is no public/templates or locales/**/**/templates directories. The task will create these per what it finds in the "matt" component.

$ grunt symlink

After running the task, we have symlinked the files: matt.dust, joni.dust, matt.properties, joni.properties to the appropriate directories

Changes

To achieve this, add the grunt-contrib-symlink task to the project:

package.json

"grunt-contrib-symlink": "~0.3.0"

Add a "symlink.js" file to the tasks directory, excerpted below:

return {
options: {
	overwrite: true
},
expanded: {
	files: [{
		expand: true,
		overwrite: true,
		flatten: false,
		cwd: 'public/components',
		rename: function rename(_dest, src) {
			var dest = src.replace(/(.+)(\/templates)(\/.+dust)/g, 'public/templates/components/$1$3');
			return dest;
		}
	}, {
		expand: true,
		overwrite: true,
		flatten: false,
		cwd: 'public/components/',
		src: ['*/*/*/*/*.properties'],
		rename: function rename (_dest, src) {
			var dest = src.replace(/(.+)(\/locales)(\/[A-Z]{2}\/[a-z]{2})(\/.+properties)/g, 'locales$3/components/$1$4');
			return dest;
		}
	}]
}
}