How do I set a basedir in Jade using command line - command-line

Is there a way to set 'basedir' option in jade command line? Or, maybe, another way to use absolute pathing there. Thanks.

Jade has, among other options, the following
-O, --obj <str|path> JavaScript options object or JSON file containing it
So you could write something like this:
jade -O "{basedir:'/home/charlie/Git/ElfSite/Code'}" temp.jade
Or you could create a file called options.json that looked something like this:
{
"basedir": "/home/charlie/Git/ElfSite/Code",
"title": "My Title"
}
And then call jade like this:
jade -O options.json temp.jade
Or like this:
jade --obj options.json temp.jade

Related

Generating XML using ViewModelAsXML

How do I render a XMLdocument containing these xsi adm xmlns tags with corresponding URI, I have tried the NodeName tagged value but without luck... Replace would do it but is there a more robust way?
I myself would use the opendocumentreport logic with a static template that holds xml documents with all namespaces and details:
vCurrent_GoogleFeed2.FeedResult:=vCurrent_GoogleFeed2.opendocumentreportasblob( GoogleFeed.Viewmodels.GoogleFeedReport ).asstring
And my template looks like this:

Describe process.env in jsdoc

I use Dotenv-Webpack. So, in js code I can do something like:
console.log(process.env.DB_HOST);
But I want to have autocomplete for values from my .env file.

Getting nsuri in Eclipse

I have Tree.ecore as source Metamodel. I need to write something like this:
model Tree driver EMF {nsuri="http://www.eclipse.org/emf/2002/Tree"};
How can I get exact nsuri of my registered ecore in eclipse?
If you are using #namespace(uri="Tree", prefix="Tree") in your Emfatic metamodel, then the nsuri you're looking for is Tree (nsuri stands for "namespace URI")
I suppose you have generated the model code for your Tree.ecore
Then you get the nsuri and all other elements (like all EAttributes, EReferences etc) via the generated static Package class.
In your case it is probably called TreePackage.
So you get the nsuri like this:
TreePackage.eNS_URI or TreePackage.eINSTANCE.getNsURI()
Update:
If you only have the *.ecore file and want to know the uri, open the file with a text editor and look in the <ecore:EPackage tag at the beginning of the file. There you see the attribut nsURI

Coffee script with erb extension gives missing template error

I am using rails 3.2.11 and coffee rails 3.2.2.
Here I am trying to render a coffee script in a file /app/views/my_files/create.js.coffee.erb
Here is what my controller code looks like
class MyFilesController < ApplicationController
respond_to :js
def create
end
end
On hitting create action I get missing template error. But when I rename file create.js.coffee.erb to create.js.coffee it works fine.
I am not understanding what is the problem with .erb extension over .coffee, and in this case why it gives missing template error, when template is already there?
Thanks
Rename your file to create.js.coffee
See
How to render new.js.coffee.erb in app/views?
Just had the same problem...
Is there a particular reason you are trying to render coffeescript as a view rather than using it as an asset?
.erb is a ruby script file that produces an html file when compiled.
.js.coffee results in a .js file when compiled. You should be using .erb with a create.html.erb template that in turn uses your create.js.coffee.
<%= javascript_include_tag "create" %>
This should be in your create.html.erb which will be called by the create method in your MyFilesController

jade "include" doesn't work as expected

Referencing another Jade file from within one:
include ../widget
Renders HTML like this:
<include>../widget</include>
Using Scalatra, specifically. What am I doing wrong?
Scalate Jade is different than JavaScript Jade, so the tag isn't the same. You have to reference the filename in full, like so:
- include("../widget.jade")