-
-
Save dbashford/7189582 to your computer and use it in GitHub Desktop.
{ | |
"name": "Durandal Mimosa Skeleton", | |
"version": "2.0.0", | |
"dependencies": { | |
"jquery":"1.9.1", | |
"requirejs":"2.1.8", | |
"requirejs-text":"2.0.3", | |
"knockout.js":"2.3.0", | |
"bootstrap":"2.3.2", | |
"font-awesome":"3.2.1", | |
"durandal":"2.0.0" | |
} | |
} |
bower: | |
copy: | |
mainOverrides: | |
"knockout.js":["knockout.js","knockout-2.3.0.debug.js"] | |
"bootstrap": [ | |
"docs/assets/js/bootstrap.js" | |
"docs/assets/css/bootstrap.css" | |
"docs/assets/css/bootstrap-responsive.css" | |
] | |
"font-awesome": [ | |
{ font: "../../font" } | |
"css/font-awesome.css" | |
"css/font-awesome-ie7.css" | |
] | |
"durandal": [ | |
{ | |
img: "../../images" | |
js: "durandal" | |
css: "durandal" | |
} | |
] |
Awesome! This helps me a lot.
Some things I discovered which might help others...
The only way I could find to reliably push files from bower_components over to assets after making changes to mainOverrides was to remove the entire contents of .mimosa/bower and then run mimosa bower
If you specify a directory to include, subdirectories are not included. Manually specified subdirectories are also ignored (because they'd be flattened in the assets/vendor/package folder anyhow), so say you wanted the /less and /less/mixins dirs from bootstrap, your main override would like like this:
'bootstrap': [
'js',
'less',
{ 'less/mixins': './bootstrap/mixins' }
],
The only way I could find to reliably push files from bower_components over to assets after making changes to mainOverrides was to remove the entire contents of .mimosa/bower and then run mimosa bower
mimosa watch -C
Does the trick also.
I, too, found this to be required. Is it considered a bug?
All files end up in
vendor.javascripts
(a mimosa configuration parameter) folder, that defaults tojavascripts/vendor
, or invendor.stylesheets
, which defaults tostylesheets/vendor
.mimosa-bower will place all javascript files inside
vendor.javascripts
. It will place all files that are not javascript relative to thevendor.stylesheets
directory. So, for instance,.jpg
and.png
files would be placed relative tovendor.stylesheets
.Where files for each Bower module are placed inside, for instance,
javascripts/vendor
depends on thestrategy
being used. The default strategy ispackageRoot
(and this config does not modify that default) which means files are placed inside a folder named for the module. A bower package namedfoo
would have its contents placed in ajavascripts/vendor/foo
folder because ofstrategy: 'packageRoot'
.knockout.js
is just a string array. Each string is a path in the bower module. The file at that path is pulled from its location and placed inside thepackageRoot
. So, in the case ofknockout.js
, files namedknockout.js
andknockout-2.3.0.debug.js
, located at the root of the Bower module, are placed inside ajavascripts/vendor/knockout.js
folder. The knockout Bower module can be found here: https://github.com/bowerjs/knockout/tree/2.3.0, and you'll see those two files are there at the root of the repository.bootstrap
is also a string array, except each string is a very specific deep path into the Bower module. The bootstrap Bower module can be found here: https://github.com/twbs/bootstrap/tree/v2.3.2. Note that link points right at the 2.3.2 tag as defined by thebower.json
above.The
font-awesome
section also has strings in its array. Those two strings are handled just like the knockout and bootstrap strings. The array also has an object in it. That object allows for specific placement of files and folders. In this case thefont
folder inside the bower module is placed, in its entirety, unedited, two directories up fromstylesheets/vendor
in a directory calledfont
, which means in afont
directory at the same level asstylesheets
. Thefont-awesome
bower module can be found here: https://github.com/FortAwesome/Font-Awesome/tree/v3.2.1The
durandal
bower modulemainOverride
is just an object. Each entry in that object is a folder, and each folder is placed in its entirely, unedited, at the given location. Theimg
folder of the module will end up in aimages
folder at the same level asstylesheets
andjavascripts
. Thejs
folder lands inside adurandal
folder insidevendor/javascripts
, and thecss
folder lands inside adurandal
folder insidestylesheets/vendor
.Take a look at the finished product here: https://github.com/dbashford/Durandal-Mimosa-Node-Skeleton. All this action happens inside the
watch.sourceDir
, which is, by default,assets
.