I have components that has dynamic parts with compose. The dynamic parts are in other modules i.e. node projects.
If I want to use a custom element in a page like:
<my-custom-element body.bind="someVariableContainingThePath"></my-custom-element>
I get an error saying that the viewmodel specified in someVariableContainingThePath cannot be found in ./my-custom-element/someVariableContainingThePath.
What is the recommended way to deal with paths when using compose element.
I'm using webpack.
Is there a way to alias a module.
So can set someVariableContainingThePath='moduleA' and then specify
that moduleA = /some/path/my-body-custom-element ?
For webpack bundling you have to give it a hint. Otherwise your view will not get bundled.
you can add your component to globalResourses when configuring aurelia
http://aurelia.io/docs/fundamentals/app-configuration-and-startup#making-resources-global
You have to decorate your module names with PLATFORM.modulename as in .globalResources(PLATFORM.modulename('my-module'))
Related
I have developed a rest-api client (in java) customised to the needs of my product. I wanted to generate tests using my rest api client using swagger-codegen modules based on yaml-file.
I have already extended DefaultCodegenConfig & even tried implementing the CodegenConfig interface to build my custom jar. I have customized the api.mustache and api_test.mustache files and passing them in the constructor and processOpts() method of my CustomCodeGen that extends DefaultCodegenConfig.
However, I want to use the custom/new mustache template variables that I have added in my customised api.mustache.
For e.g. if refer to standard api.mustache, the template variables it typically uses are
- {{classname}}
- {{#operation}}
- {{#contents}}
- {{#parameters}}
etc.
Now, I want to introduce a new template variable, let's say {{custom_param}}. Now I am not clear how do I integrate this new template variable with the implementation.
Looks like from this Mustache-Template-Variables published here, swagger-codegen does not allow adding new template-variables and perhaps we are restricted to only the variables mentioned on this page.
So, is there some way to make the new template variables work ?
Some time ago I added the uniqueItems parameter for bean validation as it was not getting processed by the engine even though it was a part of the implemented JSR.
So I believe codebase needs to be updated to use your own variable which is only possible if you fork the code.
In case it helps, these two were the PRs:
For query parameters: https://github.com/swagger-api/swagger-codegen/pull/10154.
For body parameters: https://github.com/swagger-api/swagger-codegen/pull/10490.
In a gsp file there is line like below
<g:each in="${tools}" var="tool" status="counter">
and when i debug it shows value like below
It's using Grails framework. May I know how can I find where is this ${tools} declared and being called from to this GSP?
Grails uses convention over configuration. So in order to trace back where tool is being set, you have to note the name of the gsp file and the directory in which it is placed.
Ideally if the gsp name is bar.gsp and is placed under foo directory under grails-app/views then the convention is that there could be a FooController.groovy under grails-app/controllers which would have an action called bar(). Most likely the model is set with the variable tools inside the baraction.
This exercise would be a good starting point.
What #dmahapatro suggested is the best approach but if you are still unable to find that tools variable and simply do a project level search in the IDE you are using and find the word tools.
Here are some filters you can apply to fasten your search:
First, search only in the directory grails-app/controllers
Then search in the directory grails-app/directives
Try to search following words: tools, tools:, tools : because it will be rendered as a map.
Is there a way to customize the way Asp.Net MVC4 bundling&minification feature minifies the js files?
Meaning, I don't want to completely turn off minification, but "as is" it just breaks AngularJs.
Since AngularJs uses DI and IoC approach for injecting services in controllers, the following:
function MyController($scope) { }
Once minified, becomes:
function MyController(n) { }
Normally that wouldn't be a problem, but AngularJs uses the parameter names to understand which service to inject. So $scope should remain $scope, as well as any other parameter in angular controllers. Everything else, like local variables, etc, should be minified normally.
I can't find any clear documentation on how to configure Mvc4 minification, and it seems rather dumb for it to be "all or nothing" so I think I'm missing something.
Thanks.
Actually you can (and should!) write AngularJS code so it is "minification safe". Details are described in the "Dependency Annotation" section of http://docs.angularjs.org/guide/di but in short, for globally defined controllers you can write:
MyController.$inject = ['$scope'];
Please note that globally defined controllers are polluting global namespace (see this for more details) and should be avoided. If you declare a controller on a module level you can make it minification-safe as well:
angular.module('mymodule', []).controller('MyController', ['$scope', function($scope){
//controller code goes here
}]);
if you still want to control what to minify and what not (or if you want to include an already minified version by the plugin vendor) just declare two bundles, and only minify one of them on your BundleConfig.cs:
var dontMinify = new Bundle("~/bundles/toNotMinify").Include(
"~/Scripts/xxxxx.js");
bundles.Add(dontMinify);
var minify = new Bundle("~/bundles/toNotMinify").Include(
"~/Scripts/yyyyyy.js");
minify.Transforms.Add(new JsMinify());
bundles.Add(minify);
For those of you who don't want/can't be arsed to write the "minification-safe" angular-DI syntax, and don't care about variable names being obfuscated, I used BundleTransfomer along with Yui Js minifier - available via nuget:
Install-Package BundleTransformer.Core
Install-Package BundleTransformer.Yui
Gives VERY fine-grained control over minification/obfuscation. In the angular world, just set the obfuscateJavascript within the yui web.config section to false.
I want to include a spark view in another spark view.
I've tried to use the include tag.
But it doesn't seem to support variables as part of the href attribute.
Eg.
<include href="_group_${groupData.Type}.spark" />
Does anyone know of any workaround to do this?
The <include> tag is part of the Spark language that gets parsed on the first pass and cannot include variables of its own because the view class file has not yet been generated for the variables to be evaluated. Using <include> is a means of including a static resource of some kind.
I think the thing you may be looking for is the <use import="myFile.spark"/> tag for including other Spark files, or you could just use Spark Partials built in. The problem however is that you're trying to have the included spark files dynamically determined at runtime which I don't think will be possible.
Is there any way you can pre-generate the views for each groupData.Type value using the pre-compilation ability in Spark?
The other option potentially (if you really do need these dynamic at runtime) is to create and maintain an InMemoryViewFolder instance and you can add "virtual" files to it as you pull them out of the database but you still won't get away with using variables inside any Spark language elements because variables "don't exist" at that point in the parsing/rendering pipeline.
Hope that helps,
Rob
I'm developing a Grails App. I have about 20 Controllers right now and there will be more. Is there a way to Group the Controllers in functional Packages? I would like to have something like:
grails-app/administration/<controller classes>
grails-app/usercontent/<controller classes>
grails-app/publiccontent/<controller classes>
The best would be if the Package would not appear in the URL.
You can do something similar by putting your controllers into Java/Groovy packages:
package administration
class UserController { ... }
and placing the source code into corresponding sub-directories of grails-app/controllers/, eg. grails-app/controllers/administration/UserController.groovy. This won't change the default URL Mapping (ie. the package name is not included in the URL). Note however, that your controller names have to be unique even across different packages!
I'm not aware of any easy approach to achieve the directory layout you suggested (no controller/ in the path).