ui-ace
ui-ace copied to clipboard
ace.js in bower.json
I'm working on learning AngularJS and associated workflow using the Yeoman generator-angular to scaffold the basic seed project. I'm evaluating a couple embeddable editors and installed ui-ace via Bower:
bower install angular-ui-ace -S
This properly installs everything to bower_components and adds ui-ace.js as a dependency in bower.json:
{
...
"angular-ui-ace": "~0.1.1"
}
Which in turn adds the script to index.html on grunt:
<script src="bower_components/angular-ui-ace/ui-ace.js"></script>
The issue is ace.js (which is required) is not added as a dependency on install:
<script type="text/javascript" src="bower_components/ace-builds/src-min-noconflict/ace.js"></script>
Does anyone know the proper syntax to add it as a dependency in bower.json so it is included in my build?
The file '.bower.json' in ace-builds doesn't contain a main property, so bower can not know which file to inject. You can add "main": "./src-min-noconflict/ace.js"
in that file, then it can be injected.
But the proper way is to let ace-builds project to modify.
We had to deal with this issue as well and it's more than just adding the ace.js file to the ace-builds project's bower.json file. The underlying ace-builds actually comprise of many files - extensions, themes, modes, etc. This is likely going to need to be customized on a per-project basis. We handled this by using wiredep, which uses an overrides
property in our bower.json like so:
"overrides": {
"ace-builds": {
"main": [
"src-min-noconflict/ace.js",
"src-min-noconflict/mode-html.js",
"src-min-noconflict/mode-handlebars.js",
"src-min-noconflict/mode-json.js",
"src-min-noconflict/theme-eclipse.js"
]
}
}
Note this method is not finalized in the bower spec per bower/bower.json-spec#27.
I do agree the ace-builds project needs to modified regardless - it should at least set main to ace.js, includes everything in the ace-builds repo (50MB), and I can't see a bower.json file anywhere in their project, but that's another story.
+1 for adding ui-ace.js and ace.js to main in the bower.son.