Wednesday 15 July 2015

javascript - How do I parse '<%= =>' in grunt? -


Many content plugins allow for this syntax, in which files are included to include:

  ['& lt;% = src_dir% & gt; / Normal / ** / *. JS ',' & lt;% = src_dir% & gt; / App / ** / *. Js']  

or

  ['<=% test_files.js%>']  
< P> Is there any way I can call in some library, these pars and give me an array of actual output? Or is it made straight in a pan? I'm not sure how to view Google's terms for creating this show.

Thanks

You are either looking for, or, depending on it By doing so where you are acquiring the value and how you want to process them.

grunt.config.get

Get a price from the project's grunting configuration if prop is specified , Then the value of that property is returned, or null if that property is not defined if prop is not specified, then returned a copy of the entire config object has gone. Template strings will be processed by using the grunt.config.process method.

grunt.config.get ([prop])


grunt.config.process < / Strong>

Process the value, recursion in the context of grunt config (as grunt.template.process method ) Through the templates. This method is automatically called by grunt.config.get but not by grunt.config.getRaw .

  grunt.config.process (value)  

[...]


grunt.template.process

Process a low-dash template string template will be processed until another template is in process Do not be.

The default data object is the entire config object, but if options.data is set, that item will be used instead of the default template delimiter & lt; %% & Gt; but if options.delimiters is set to a custom delimiter name ( grunt.template.addDelimiters ), those template delimiters will be used instead.

  grunt.template.process (template [, option])  

Inside templates, the wand object is highlighted so that you & lt ;% = Grunt.template.today ('yyyy')%> can do things like. Note that if the data object already has a grunt property, then Grunt API templates will not be available.

In this example, the buzz property is processed again until any other and <%> process No templates for

  var obj = {foo: 'c', bar: 'b & lt;% = foo% & gt; D ', Falcon:' A 'and' L;;% = Bar% & gt; E '}; Grunt.template.process ('& lt;% = baz% & gt;', {data: ojj}) / 'abcde'  

No comments:

Post a Comment