Dojo layer don't includes all essentials - dojo-build

I have a sample script which uses
dojo.require("dojo.parser");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.layout.TabContainer");
dojo.require("dojox.grid.DataGrid");
dojo.require("dijit.Tree");
dojo.require("dojo.data.ItemFileReadStore");
I want to create a minified build of dojo, so I use this profile
dependencies = {
stripConsole : "normal",
selectorEngine : "acme",
optimize : "closure",
layerOptimize : "closure",
cssOptimize : "comments.keepLines",
mini : true,
internStrings : true,
localeList : "en-us",
releaseName : "dojo.custom",
action : "release",
optimize : "shrinksafe",
layerOptimize : "shrinksafe",
layers : [
{
name : "dojo.js",
dependencies : [
"dojo.parser",
"dojo.data.ItemFileReadStore",
"dojox.grid.DataGrid",
"dijit.layout.BorderContainer",
"dijit.layout.ContentPane",
"dijit.layout.TabContainer",
"dijit.Tree"
]
}
],
prefixes: [ [ "dijit", "../dijit" ], [ "dojox", "../dojox" ] ]
}
Yes, builder compile huge dojo.js file which I include in my html page, but still there is MANY xhr requests. System loads scripts which I don't use explicitly. Here's a screenshot

Interesting.
Are you sure the browser is successfully finding and loading the compressed version?
The browser is looking for _base.js which should definitely already be baked into that file.
Update
Tommi - dojo.js layer is always built by the build system, you don't have to explicitly declare it. I'm not sure what the effect will be of you explicitly declaring it along with dependencies. This might work, but it might not. Maybe the dependencies are overridding the normal dojo.js contents.
What I normally do is just let the system build dojo.js and then create a layer that has all the dijit/dojox stuff that I may want, and deploy that. I also usually create a 3rd separate file with my custom stuff in it.
I would try that. The key I think is to make a separate layer from dojo.js. (But still include the normal dojo.js in your page).

Related

Enable users of github program to configure their own DCMake prefix path

Consider a situation where people work together on the same code base; c++ with cmake. Code base depends on a library, that must be installed separately.
Each user may have the library in a different location. A user may invoke cmake like this:
cmake -DCMAKE_PREFIX_PATH=/path/for/that/user .
However, this is not very easy in all circumstances (e.g. windows and visual studio), and requires retyping. So instead, we have
list(APPEND CMAKE_PREFIX_PATH "/path/for/user")
In the CMakeLists.txt. This works, but requires people to constantly change that path after pulling a branch, which is annoying and easily forgotten. Is it possible to configure in a way that pulling new branches does not override this path, once set on a specific machine?
You can have each of your users create their own CMakeUserPresets.json file, and set it in the cacheVariables field of a configurePresets entry.
// CmakeUserPresets.json
{
"version": , // pick one
"cmakeMinimumRequired": {
"major": , // pick one
"minor": , // pick one
"patch": // pick one
},
"configurePresets": [
{
"name": "starball",
"displayName": "Starball's config",
"description": "Starball's private configuration preset",
"generator": "...",
"binaryDir": "...",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "..."
},
"environment": {}
}
],
// ...
}
Make sure to put CMakeUserPresets.json in your .gitignore file (or whatever else you have to do for your specific VCS so that the user preset file isn't tracked in the VCS).

How do I create a custom Semantic Token for VSCode?

I'm creating a color theme and I found out that the only way to target function parameters with italic is by using semantic highlight. The problem is that since semantic highlight overrides some settings, I lost the ability to target support.function.console - the "log" of console.log, for instance.
.log is a member.defaultLibrary, but if I target that by semantic, some other things would also be styled with the same color. That wouldn't be bad if member.defaultLibrary wasn't so inconsistent, some things you would expect to be styled, is not, which leads to inconsistency, which is certainly not desirable.
querySelector() is styled by member.defaultLibrary but not querySelectorAll(), for instance. I also tried to not use anything that can be overridden by semantics but then, it creates too many exceptions and some functions and methods would be let without any style, which is much worse.
I've tried Semantic Token Classification and tried to add a custom semantic token to the package.json file of the extension but I don't know how to "wire" that up:
{
"contributes": {
"semanticTokenTypes": [
{
"id": "consoleSupport",
"description": "console support"
}
],
"semanticTokenScopes": [
{
"scopes": {
"consoleSupport": ["support.function.console"]
}
}
]
}
}
When using development host, it does recognize the "new" consoleSupport when I try to add to "semanticTokenColors", it suggests the auto-complete, so I'm probably half-way there but I don't know how to actually create the new token and how to make it work.

jbpm kieworkbench does not show icon for custom workitemdefinition

I'm using the KIE workbench in JBPM 6 (6.1) to set up a process. I also added a custom work item definition like this:
[
"name" : "MyTask",
"parameters" : [
"Param1" : new StringDataType()
],
"results" : [
"Result" : new ObjectDataType(),
],
"displayName" : "MyTask",
"icon" : "myicon.png"
]
In addition I uploaded the corresponding file myicon.png. The icon is in the same folder as the wdi file, so the path should be correct.
Everythink works fine, except for the fact that the kie designer always shows the default icon instead of the icon I uploaded. I can also change it to a different default icon, but not to one I uploaded myself.
I can't find what is wrong. No errors are thrown in jboss log.
Thanks in advance!
Ok, it seems that this is a known bug due to https://issues.jboss.org/browse/JBPM-4407

Continuing development in CoffeeScript while implementing RequireJS

I want to implement RequireJS in a very large single page application that uses CoffeeScript and Grunt. We have separate files for different modules (services, Backbone, etc.).
Implementing RequireJS is very straightforward - my main problem is with the size of the application and CoffeeScript's whitespace sensitivity. We need to be able to continuously develop new features while implementing RJS. The reason we cannot do this is because we would have to wrap all files in define calls, and re-tab files. When you try to rebase this code, massive merge conflicts arise due to the tabbing. No one has the time to solve all those problems, as new features and bugfixes may have been introduced pre-RJS.
I've research a few possible solutions:
Stop development and re-tab everything. This sucks because development is stopped until files are tabbed and the code actually works with RJS.
Use CommonJS pattern, and use RJS CommonJS converter pre-RJS optimize. Seems hacky.
Use CoffeeScript backtick functionality to wrap CoffeeScript classes in a standard JavaScript module pattern. Next pass dependencies to the "module" wrapper for the CoffeeScript class then initialize the "module" within the RJS call in the file.
Edit:
Thanks for the tip on the vertical structure & introducing me to passing function arguments that way (comma-less). Our projects are very similarly in structure (except grunt-contrib-coffeee does the linting, unfortunately, at the moment), and I am also building a custom watch task to compile single files (vs. glob patterns).
Consider this very basic example:
view.coffee:
class View
template: Helper.template
constructor: (#options) ->
render: (meters) ->
$('body').html #template #options
The normal process would be to do something like the following with RJS:
define [
'jQuery'
'Helper'
], (
$
Helper
) ->
class View
template: Helper.template 'base_view'
constructor: (#options) ->
render: (meters) ->
$('body').html #template #options
Notice how the entire class has been re-tabbed. Git would hate this if any one of our developers came along and modified the View class, while I was trying to implement require in parallel.
The backtick idea won't work, I can't get around the global problem there:
`var exports = function($, Helper) {
class View
template: Helper.template
constructor: (#options) ->
render: (meters) ->
$('body').html #template #options
return View }(jQuery, Helper)`
define [
'jQuery'
'Helper'
], (
$
Helper
) ->
return exports($, Helper)
I think my best bet is merging all of the applications features together and then pausing for a moment to re-tab every file the necessary two spaces, all in one commit. CoffeeScript doesn't seem to care where the indentation begins (column 0 vs column 2) as long as the rest of the file follows that pattern. We should be able to slide in RJS and implement it progressively in this way, preventing unsolvable merge conflicts.
What we do in our projects:
we use grunt-contrib-coffee and grunt-coffeelint to compile and validate coffee files. With this plugin, you can validate the coffeescript code while developing. You can use a json file which contains validation settings. This makes sure all developers use the same settings.
e.g:
{
"no_tabs" : {
"level" : "error"
},
"no_trailing_whitespace" : {
"level" : "error"
},
"max_line_length" : {
"value": 200,
"level" : "error"
},
...
minimize the chance of merge conflicts in requirejs dependecies by defining each dependency on a separate line.
e.g.
define [
'dep1'
'dep2'
'dep3'
], (
dep1
dep2
dep3
) ->
console.log "Hello"
instead of
define ['dep1', 'dep2','dep3'], (dep1, dep2, dep3) ->
console.log "Hello"
Only commit coffeescript files to source control. Generated javascript files (minified via grunt-contrib-requirejs) we don't commit (only when creating a production version).
we use a custom watch task to watch changed coffeescript files (among other files). Via growl the developer is notified when compilation or validation failed.

CKEditor: how to remove a plugin that has been added?

I'm just beginning to use CKEditor, but have a hard time understanding the plugins system.
I was able to add a simple button that says 'Test' when you click on it with :
var myplugin_function = function () {
alert('Test');
}
var plugin_name='myplugin';
CKEDITOR.plugins.add(plugin_name,
{
init:function(c) {
c.addCommand(plugin_name,myplugin_function);
c.ui.addButton(plugin_name,
{
label:'This is my plugin',
command:plugin_name,
icon:this.path+'myplugin.png'
});
}
});
I know this code should be executed only once, for example in a plugin.js, but that's not how I use it. The CKEditor instance, including my plugin code is executed each time the Ajax-page is loaded.
That's why I use this to remove the instance, if it exists :
if (CKEDITOR.instances['mytextarea']) {
CKEDITOR.remove(CKEDITOR.instances['mytextarea']);
}
Then I use the jquery way to create the ckeditor from a textarea:
$('#mytextarea').ckeditor();
But the 2nd time the ajax-page loads, I get an error about the plugin already being registered. So I need a way to remove the plugin and be able to add it again.
Is this even possible?
UPDATE
This seems to work :
I now check if the plugin is already registered with :
if (!CKEDITOR.plugins.registered[plugin_name]) {
}
around the CKEDITOR.plugins.add(b, ... part
You are not showing how you are adding the plugin, so it's hard to tell what's your exact problem; but from the code that you have provided I can suggest that you use variable names better than "a", "b" and "c". It's quite harder to understand the code this way.
Also, CKEDITOR.remove just removes the instance from the instances array, but it doesn't really clear the used resources, you should use CKEDITOR.instances['mytextarea'].destroy( true ) instead