phated / grunt-jade Goto Github PK
View Code? Open in Web Editor NEW(No Longer Supported) Grunt.js plugin to compile jade templates to JavaScript functions (normal or AMD) or plain HTML
License: MIT License
(No Longer Supported) Grunt.js plugin to compile jade templates to JavaScript functions (normal or AMD) or plain HTML
License: MIT License
Not sure if it is necessary. I saw a branch with window designated, but is it needed or does anyone else want it? The only way I can see it not getting attached to window is if it is used in an AMDed function, and that case is covered.
Heya,
Just a small change I feel we could do with looking into... in the helpers we could do with catching jade compile errors a little more gracefully so that when we use growl-notify it doesn't stop grunt continuing the watch tasks.
Will submit a pull request, just that we have a grunt task for development that will allow front-end devs to keep saving the jade file and recompile with growl notifying when a success or failure has happened with jade they have edited.
I have newest node and npm. I have tried my jade code with 2 linters. I have used grunt-contrib-jade before and it compiled normally but this one provided more options.
module.exports = function(grunt) {
grunt.initConfig({
sass: {
options: {
sourceMap: true
},
dist: {
files: {
'app/static/css/main.css': 'app/static/sass/main.sass'
}
}
},
jade: {
html: {
files: {
'app/templates/': ['app/templates/*.jade', '!app/templates/layout.jade']
},
options: {
client: false
}
}
},
ts: {
options: {
fast: 'never',
failOnTypeErrors: false
},
default: {
files: {
'app/static/js/app.js': 'app/typescript/app.ts'
}
}
},
watch: {
files: [
'app/templates/**/*.jade',
//'app/typescript/**/*.ts',
'app/static/**/*.sass'
],
tasks: ['compile']
}
});
grunt.loadNpmTasks("grunt-ts");
grunt.loadNpmTasks('grunt-jade');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-sass');
grunt.registerTask('compile', ['sass', 'jade']);
grunt.registerTask('default', ['compile', 'watch']);
};
and jade:
extends layout
mixin scripty(url)
script(src="/js/#{url}")
script(src="/static/js/#{url}")
block head
script(src="https://code.angularjs.org/tools/system.js")
script(src="https://code.angularjs.org/tools/typescript.js")
script(src="https://code.angularjs.org/2.0.0-alpha.44/angular2.dev.js")
+scripty("app.js")
block content
h1= title
p Welcome to #{title}
my-app loading...
block scripts
error:
Running "jade:html" (jade) task
Verifying property jade.html exists in config...OK
Files: app/templates/index.jade -> app/templates/
Options: client=false, runtime, pretty=false, compileDebug=false, extension=null, wrap=null, locals=null, basePath=null
Options: client=false, runtime, pretty=false, compileDebug=false, extension=null, wrap=null, locals=null, basePath=null
Reading app/templates/index.jade...OK
Compiling app/templates/index.jade...Warning: Unexpected identifier Used --force, continuing.
Writing app\templates\index.html...OK
how can this file be built with grunt-jade?
jade-amd --runtime > public/js/jadeRuntime.js
via
I'm posting this issue to let you know that we will be publishing Grunt 0.4 on Monday, February 18th.
If your plugin is not already Grunt 0.4 compatible, would you please consider updating it? For an overview of what's changed, please see our migration guide.
If you'd like to develop against the final version of Grunt before Monday, please specify "grunt": "0.4.0rc8"
as a devDependency in your project. After Monday's release, you'll be able to use "grunt": "~0.4.0"
to actually publish your plugin. If you depend on any plugins from the grunt-contrib series, please see our list of release candidates for compatible versions. All of these will be updated to final status when Grunt 0.4 is published.
Also, in an effort to reduce duplication of effort and fragmentation in the developer community, could you review the grunt-contrib series of plugins to see if any of your functionality overlaps significantly with them? Grunt-contrib is community maintained with 40+ contributors—we'd love to discuss any additions you'd like to make.
Finally, we're working on a new task format that doesn't depend on Grunt: it's called node-task. Once this is complete, there will be one more conversion, and then we'll never ask you to upgrade your plugins to support our changes again. Until that happens, thanks for bearing with us!
If you have any questions about how to proceed, please respond here, or join us in #grunt on irc.freenode.net.
Thanks, we really appreciate your work!
Need to rewrite plugin using the new init template and make code more testable + add more tests.
Does anyone want the options processed by grunt.template.process before merged with defaults?
If not all the options, what about just locals? This might remove the need for locals to allow a function.
I'm trying to use this in a build step of a component to compile jade templates to javascript. Everything is working great, except I have to make one tiny change to the node template to get it to work properly. I know I'm probably abusing the way the node template is intended to work, so feel free to close this and tell me I'm doing it wrong or that this requires a new template type. In the node template, I have to remove the ./
from the require call. When I remove the ./
, it works perfectly and it's able to find the runtime because of the way component require
works.
Here is the grunt-jade snippet from my Gruntfile:
jade:
all:
files:
'dist/table/templates': ['lib/table/templates/*.jade']
options:
runtime: false
wrap:
wrap: true
amd: false
node: true
dependencies: 'jade-runtime'
When compiling, I'm losing the jade templates folder structure and this is problematic for me, as all the html files get mixed in the same directory.
This commit from Richard Butler was very useful for me:
richardbutler@7e34aec
It would be nice if you could merge it.
grunt.registerHelper will be depreciated in grunt 0.4.
To see how helpers will be handled in the future (using standard npm require), check out the following links:
https://github.com/gruntjs/grunt-contrib-uglify/blob/master/tasks/uglify.js#L15 https://github.com/gruntjs/grunt-contrib-uglify/blob/master/tasks/lib/min.js
PS: join us in #grunt on freenode if you have any questions!
mixin hero(title)
.hero
.hero__inner
h1.hero__title #{title}
So, my project uses a Jade mixin like the above on multiple pages and, when I compile the Jade to HTML pages, I have to copy that mixin on each page that it is used.
Can this module be used to globally pass that mixin to all pages so I don't have to copy it everytime?
It would make my life 1000x easier.
So I'm a bit baffled by all of the options available; say that I have a directory (with sub-directories) containing my *.jade templates. For example:
'app/views/index.jade'
'app/views/partials/home.jade'
'app/views/partials/products/management.jade'
'app/views/partials/users/update.jade'
etc..
and I want to have the compiled HTML files moved to the 'app/public/' folder, but maintain the folder structure, eg.
'app/public/index.html'
'app/public/partials/home.jade'
'app/public/partials/products/management.jade'
'app/public/partials/users/update.jade'
What combination of configuration options do I need to achieve this?
Can I do something like:
html: {
files: {
'app/public/': ['app/views/**/*.jade']
},
options: {
client: false
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.