angular-ui / ui-ace

This directive allows you to add ACE editor elements.
http://angular-ui.github.io/ui-ace
MIT License
578 stars 172 forks source link

feat(directive): worker path for concatenated and minified configuration... #61

Closed ciel closed 9 years ago

ciel commented 10 years ago

feat(directive): worker path for concatenated and minified configurations

add "workerPath" option to the directive so that ace can be run even if the files are concatenated, since the concatenation process would cause the workerPath to return a 404 otherwise.

This is useful if you want to minify and concatenate the source, because doing so causes the worker path to return a 404. It is used like this;

<div ng-model="Model.Scripting"
     ui-ace="{
        useWrapMode: true,
        showGutter: true,
        theme: 'chrome',
        mode: 'javascript',
        workerPath: '/application/assets/scripts/ace'
    }">
</div>
ciel commented 10 years ago

@douglasduteil

I even managed to get unit tests done first this time! I'm pretty proud of it, honestly. This was created because when I tried to package and minify my project using ASP.NET MVC Web Optimization Framework, I kept getting all kinds of errors that I couldn't find a fix to. So more exploring led to the method of declaring the worker path manually.

This could be done in the aceLoaded function, but honestly part of the appeal to the directives to me is the one-place configuration. I don't really like to try and ad-hoc behavior between the controller and directive unless it is a directive being written in the program.

So this one solved the issue for me. It would still mean that one file is not actually minified, but I could not discover a way around that except to set setUseWorker to false, and I don't think that is good because I noticed a marked hit to performance doing it that way.

douglasduteil commented 10 years ago

Woho cool @ciel Can you update the README too ? I'll make a release with those brand new features of yours. Thanks.

ciel commented 10 years ago

You bet. I'll get working on it shortly. I'm still not giving up learning how to squash my repositories. This has been such a stimulating learning experience, and I get to contribute to a project I am actively using in development. I couldn't ask for a better situation.

ciel commented 10 years ago

Hey @douglasduteil - I did a new pull request with the requested update to the readme. I hope it is acceptable. When the changes are merged, is it safe for me to delete the branches on my own repository that I did the pull request from? Or do they need to stay there permanently?

ciel commented 10 years ago

Hey @douglasduteil, Is this going to be merged anytime soon?