![]() Templates // base.jade Go Templateīy default, the search will be recursive and will match only files ending in ".jade". Templates, err := jade.CompileDir("templates/", jade.DefaultDirOptions, jade.DefaultOptions) If there are templates in subdirectories, its key in the map will be it's path relative to dirname. Necessary runtime functions will be injected and the template will be ready to be executed. Returns a mapping of template name (extension stripped) to corresponding Go Template (html/template) instance. Parses and compiles the contents of a supplied directory name. func CompileDir func CompileDir(dirname string, dopt DirOptions, opt Options) (map*template.Template, error) Returns corresponding GoĪnd the template will be ready to be executed. Parses and compiles the contents of supplied filename. func CompileFile func CompileFile(filename string, options Options) (*template.Template, error) Necessary runtime functions will be injectedĪnd the template will be ready to be executed. ![]() Parses and compiles the supplied amber template string. func Compile func Compile(input string, options Options) (*template.Template, error) #Jade html compiler softwareIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. #Jade html compiler freeto prepend someting to an existing blockĬopyright (c) 2012 Ekin Koc is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: This will be added after the description meta tag. Meta(name="description",content="This is a great website") Parent template can define several named blocks and child template can modify the blocks. In order to inherit another template, an extends keyword should be used. Template data, variables, expressions, etc., can all be passed as arguments: +link(GoogleUrl, $googleTitle, "Check out " + $googleTitle)Ī template can import other templates using import: a.jadeĪ template can inherit other templates. Mixins (reusable template blocks that accept arguments) can be defined: mixin surpriseĪnd then called multiple times within a template (or even within another mixin definition): div It is also possible to iterate over values and indexes at the same time each $i, $repo in Repositories It is possible to iterate over arrays and maps using each: each $repo in Repositories Perfectly fine to use the same method for other types of attributes: div This would yield a div with hasfriends class only if the Friends > 0 condition holds. Only block attributes can have conditions div There is a special syntax for conditional attributes. the object containing Name, LastName etc fields.) you can use $ variable p $.Nameįor conditional blocks, it is possible to use if divĪgain, it is possible to use arithmetic and boolean operators div If you need to access the supplied data itself (i.e. ![]() It is possible to define dynamic variables within templates,Īll variables must start with a $ character and can be assigned as in the following example: div Templates, err := jade.CompileDir("./templates", jade.DefaultDirOptions, jade.Options This project is a part of the Floki Web applicationįramework but can be easily used in a separate application. Most features are supported, except for javascript expressions.Ĭode is based on the Amber project. Jade.Jade is an elegant templating engine. Usage Example var jade = require('jade-compiler') Also, please do donate to many other amazing open source projects! ![]() That is roughly a cup of coffee per month. The absolute best thing to do is to sign up with Gittip if you haven't already and donate just $1 a week. Please help me spend more time developing and maintaining awesome modules like this by donating! #Jade html compiler seriesA handy Jade compiler from a series of compilers that have the same signature. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |