split themes into css and js files
This commit is contained in:
parent
0e6bf2bd82
commit
8a3e7b0f00
53 changed files with 3687 additions and 3642 deletions
|
|
@ -337,14 +337,26 @@ function buildAce(aceProject, options) {
|
|||
project.assumeAllFilesLoaded();
|
||||
options.themes.forEach(function(theme) {
|
||||
console.log("theme " + theme);
|
||||
copy({
|
||||
/*copy({
|
||||
source: [{
|
||||
project: cloneProject(project),
|
||||
require: ["ace/theme/" + theme]
|
||||
}],
|
||||
filter: filters,
|
||||
dest: targetDir + suffix + "/theme-" + theme + ".js"
|
||||
});
|
||||
});*/
|
||||
// use this instead, to not create separate modules for js and css
|
||||
var themePath = "lib/ace/theme/" + theme
|
||||
var js = fs.readFileSync(themePath + ".js", "utf8")
|
||||
js = js.replace("define(", "define('ace/theme/" + theme + "',")
|
||||
|
||||
if (fs.existsSync(themePath + ".css", "utf8")) {
|
||||
var css = fs.readFileSync(themePath + ".css", "utf8")
|
||||
js = js.replace(/require\(.ace\/requirejs\/text!.*?\)/, quoteString(css))
|
||||
}
|
||||
filters.forEach(function(f) {js = f(js); })
|
||||
|
||||
fs.writeFileSync(targetDir + suffix + "/theme-" + theme + ".js", js);
|
||||
});
|
||||
|
||||
console.log('# ace worker ---------');
|
||||
|
|
@ -405,7 +417,8 @@ function buildAce(aceProject, options) {
|
|||
function cloneProject(project) {
|
||||
var clone = copy.createCommonJsProject({
|
||||
roots: project.roots,
|
||||
ignores: project.ignoreRequires
|
||||
ignores: project.ignoreRequires,
|
||||
textPluginPattern: project.textPluginPattern
|
||||
});
|
||||
|
||||
Object.keys(project.currentModules).forEach(function(module) {
|
||||
|
|
@ -419,6 +432,10 @@ function cloneProject(project) {
|
|||
return clone;
|
||||
}
|
||||
|
||||
function quoteString(str) {
|
||||
return '"' + str.replace(/\\/, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\\n") + '"';
|
||||
}
|
||||
|
||||
function filterTextPlugin(text) {
|
||||
return text.replace(/(['"])ace\/requirejs\/text\!/g, "$1text!");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue