Skip to content

Commit

Permalink
the most ugly fix for issue i have ever created fixes #32 with inline…
Browse files Browse the repository at this point in the history
… javascript code that handles http* and file protocol so ACE will know where to look for files
  • Loading branch information
Gutek committed Oct 6, 2014
1 parent e2c41dd commit 1e164ba
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -53,4 +53,7 @@ gulp html
// building project - creating minified version of css, js etc.
gulp dist
// if dist has been build, connect-dist will do same as connect but for dist folder.
gulp connect-dist
```
39 changes: 37 additions & 2 deletions gulpfile.js
Expand Up @@ -76,6 +76,8 @@ var rjsOpts = {
'sprintf': '../bower_components/sprintf/src/sprintf',
'uiAce': '../bower_components/angular-ui-ace/ui-ace',
'ace': '../bower_components/ace-builds/src-min-noconflict/ace',
//'ace-js': '../bower_components/ace-builds/src-min-noconflict/mode-javascript',
//'ace-monokai': '../bower_components/ace-builds/src-min-noconflict/theme-monokai',
'es-ui': './app'
}
};
Expand Down Expand Up @@ -124,9 +126,33 @@ gulp.task('dist-js', function () {
.pipe(uglify())
.pipe(gulp.dest('./es-dist/js/'));

// copy ace, do not try to minify it :/
gulp.src('./src/bower_components/ace-builds/src-min-noconflict/*')
//.pipe(uglify())
.pipe(gulp.dest('./es-dist/js/ace'));

// can't figure out better option of doing it :(
rjs(rjsOpts)
.pipe(insert.append('require(["bootstrap"]);'))
.pipe(uglify())
.pipe(insert.append(';\n\r'+

'define("es-dist-main", ["bootstrap", "ace"], function (_i, _a) {\n\r'+
' var _c = ace.require("ace/config");\n\r'+
' _c.set("packaged",true);\n\r'+
' var _aa_cfg_dist_path = "js/ace";\n\r'+
' _c.set("workerPath", location.href.replace(location.hash, "").replace("index.html", "") + "/" + _aa_cfg_dist_path);\n\r'+
' _c.set("modePath", _aa_cfg_dist_path);\n\r'+
' _c.set("themePath", _aa_cfg_dist_path);\n\r'+
' _c.set("basePath", _aa_cfg_dist_path);\n\r'+
'});\n\r'+

'require(["es-dist-main"]);\n\r'+
''))
// .pipe(insert.append(';require(["bootstrap"]);'))
// .pipe(insert.append('; var _aa_cfg_dist = require("ace/config");' +
// '_aa_cfg_dist.set("packaged",true);' +
// 'var _aa_cfg_dist_path = "js/ace";' +
// '_aa_cfg_dist.set("basePath", _aa_cfg_dist_path);'))
// .pipe(uglify())
.pipe(gulp.dest('./es-dist/js/'));

});
Expand Down Expand Up @@ -256,4 +282,13 @@ gulp.task('connect', connect.server({
}
}));

gulp.task('connect-dist', connect.server({
root: ['es-dist'],
port: 8888,
livereload: true,
open: {
browser: 'chrome'
}
}));

gulp.task('default', ['dev']);
2 changes: 2 additions & 0 deletions src/js/bootstrap.js
Expand Up @@ -3,6 +3,8 @@ define([
'angular',
'es-ui',
'run',
//'ace-js',
//'ace-monokai',
'./config/constants',
'./config/urls',
'./config/values',
Expand Down
2 changes: 2 additions & 0 deletions src/js/main.js
Expand Up @@ -11,6 +11,8 @@ require.config({
'sprintf': '../bower_components/sprintf/src/sprintf',
'uiAce': '../bower_components/angular-ui-ace/ui-ace',
'ace': '../bower_components/ace-builds/src-min-noconflict/ace',
//'ace-js': '../bower_components/ace-builds/src-min-noconflict/mode-javascript',
//'ace-monokai': '../bower_components/ace-builds/src-min-noconflict/theme-monokai',
'es-ui': './app'
},
shim: {
Expand Down

0 comments on commit 1e164ba

Please sign in to comment.