SlideShare a Scribd company logo
Using Jade, Stylus and NodeJS Together with Grunt 
Hybrid App 
Development 
Yagiz Nizipli 
Software Engineer
My Past 
Computer engineer, musician, geek. But what have I really 
been doing for the past 2 years?
Open-Source Initiative 
❖ Always a fan of open-source projects. 
❖ github.com/anonrig
Grunt - The Javascript Task 
Runner 
❖ Automation 
❖ Minification, unit testing, linting 
❖ Test-driven programming 
❖ Step by step compilation
Using NodeJs with Grunt 
❖ Node.js is an event-driven, non-blocking i/o solution for 
asynchronous application development. 
❖ On top of the language Javascript. 
❖ An example use for Nodejs with Grunt is using file 
stream library in Nodejs. 
❖ Require it using: var fs = require('fs');
An example page for our mobile 
application 
<head> 
<title>My Application</title> 
… some meta tags here … 
<stylesheets/> 
</head> 
<body> 
<script type=“text/javascript”> 
myEnvironmentVariable = {}; 
<environment/> 
</script> 
</body>
❖ Local, test and 
production 
web: { 
input:"www/index.html", 
output:"www/index.html", 
tokens: [{ 
token: "<environment/>", 
string: fs.readFileSync('src/config/web.js').toString() 
}] 
}, 
test: { 
input: "www/index.html", 
output: "www/index.html", 
tokens: [{ 
token: "<directives/>", 
string: fs.readFileSync('src/config/test.js').toString() 
}] 
}, 
prod: { 
input: "www/index.html", 
output: "www/index.html", 
tokens: [{ 
token: "<directives/>", 
string: fs.readFileSync('src/config/prod.js').toString() 
}] 
}
Why we need a template 
engine? 
❖ Don’t waste time on markup languages. 
❖ Reuse the code whenever it’s possible. 
❖ Indentation is the key point. 
❖ Use if compilation is inevitable.
Introducing Jade 
❖ Jade, accessed from jade-lang.com, is a node template 
engine for HTML5 and JavaScript. 
❖ Enables us to use HTML without the markup 
functionality. 
❖ Compiles Jade code to HTML5 and JS. 
❖ How?
An example Jade code 
Jade HTML5
Introducing Stylus 
❖ Stylus, defined by the developers, is a expressive, 
robust, feature-rich CSS preprocessor. 
❖ CSS without the unnecessary syntax. 
❖ Enables to reuse the same CSS code for multiple rules. 
❖ How?
Example Stylus code 
An everyday stylus use Using Stylus with setting variables 
body 
font 12px Helvetica, Arial, sans-serif 
a.button 
-webkit-border-radius 5px 
-moz-border-radius 5px 
border-radius 5px 
fonts = helvetica, arial, sans-serif 
body 
padding 50px 
font 14px/1.4 fonts
What now? 
❖ How to compile these engines without knowing? 
❖ That’s why we need Grunt. 
❖ Grunt offers grunt-contrib-stylus and grunt-contrib-jade 
tasks to compile both of these engines.
An example of Grunt file 
grunt.initConfig({ 
clean: { 
before: ['www/img', 'www/css', 'www/compiled'] 
}, 
jade: { 
compile: { 
options: { 
pretty: true, 
data: { 
debug: true 
} 
}, 
files: [{ 
cwd: "src", 
src: "**/*.jade", 
dest: "www", 
expand: true, 
ext: ".html" 
}] 
} 
}, 
stylus: { 
build: { 
options: { 
linenos: false, 
compress: true 
}, 
files: [{ 
expand: true, 
cwd: 'src/css', 
src: [ '**/*.styl' ], 
dest: 'www/css', 
ext: '.css' 
}] 
} 
}, 
});
Sample project demo 
❖ github.com/anonrig/istanbul-coders
Any questions?

More Related Content

What's hot

Angular2.0@Shanghai0319
Angular2.0@Shanghai0319Angular2.0@Shanghai0319
Angular2.0@Shanghai0319
Bibby Chung
 
Modern front-end Workflow
Modern front-end WorkflowModern front-end Workflow
Modern front-end Workflow
Ryukyuinteractivevietnam
 
Node.js with Express
Node.js with ExpressNode.js with Express
Node.js with Express
Gergely Németh
 
AWS user group September 2017 - Rob Ribeiro "Seeking Solutions for Debugging ...
AWS user group September 2017 - Rob Ribeiro "Seeking Solutions for Debugging ...AWS user group September 2017 - Rob Ribeiro "Seeking Solutions for Debugging ...
AWS user group September 2017 - Rob Ribeiro "Seeking Solutions for Debugging ...
AWS Chicago
 
Gatsby (Code.Talks) 2019
Gatsby (Code.Talks) 2019Gatsby (Code.Talks) 2019
Gatsby (Code.Talks) 2019
Stefan Adolf
 
Angular js
Angular jsAngular js
Angular js
Ted Hsu
 
Ruby on Rails - UNISO
Ruby on Rails - UNISORuby on Rails - UNISO
Ruby on Rails - UNISO
Lucas Renan
 
Deployments with rails
Deployments with railsDeployments with rails
Deployments with rails
Gourav Tiwari
 
JS & NodeJS - An Introduction
JS & NodeJS - An IntroductionJS & NodeJS - An Introduction
JS & NodeJS - An Introduction
Nirvanic Labs
 
New paradigms
New paradigmsNew paradigms
JavaScript Engine and WebAssembly
JavaScript Engine and WebAssemblyJavaScript Engine and WebAssembly
JavaScript Engine and WebAssembly
Changhwan Yi
 
Speed up your zombies! - Bootstrap dev environment in 5 minutes!
Speed up your zombies! - Bootstrap dev environment in 5 minutes!Speed up your zombies! - Bootstrap dev environment in 5 minutes!
Speed up your zombies! - Bootstrap dev environment in 5 minutes!
Krzysztof (Chris) Ozog
 
React Native.pptx (2)
React Native.pptx (2)React Native.pptx (2)
React Native.pptx (2)
Emilio Rodriguez Martinez
 
Building Native Android Apps with JavaScript
Building Native Android Apps with JavaScriptBuilding Native Android Apps with JavaScript
Building Native Android Apps with JavaScript
Abhishek Kant
 
Gatsby vs. Next.js
Gatsby vs. Next.jsGatsby vs. Next.js
Gatsby vs. Next.js
Borek Bernard
 
Nodeconf npm 2011
Nodeconf npm 2011Nodeconf npm 2011
Nodeconf npm 2011
Florent Jaby ヅ
 
Clojure Lightning Talk
Clojure Lightning TalkClojure Lightning Talk
Clojure Lightning Talk
GiltTech
 
Bindings dojo
Bindings dojoBindings dojo
Bindings dojo
Steinar Þór Árnason
 

What's hot (18)

Angular2.0@Shanghai0319
Angular2.0@Shanghai0319Angular2.0@Shanghai0319
Angular2.0@Shanghai0319
 
Modern front-end Workflow
Modern front-end WorkflowModern front-end Workflow
Modern front-end Workflow
 
Node.js with Express
Node.js with ExpressNode.js with Express
Node.js with Express
 
AWS user group September 2017 - Rob Ribeiro "Seeking Solutions for Debugging ...
AWS user group September 2017 - Rob Ribeiro "Seeking Solutions for Debugging ...AWS user group September 2017 - Rob Ribeiro "Seeking Solutions for Debugging ...
AWS user group September 2017 - Rob Ribeiro "Seeking Solutions for Debugging ...
 
Gatsby (Code.Talks) 2019
Gatsby (Code.Talks) 2019Gatsby (Code.Talks) 2019
Gatsby (Code.Talks) 2019
 
Angular js
Angular jsAngular js
Angular js
 
Ruby on Rails - UNISO
Ruby on Rails - UNISORuby on Rails - UNISO
Ruby on Rails - UNISO
 
Deployments with rails
Deployments with railsDeployments with rails
Deployments with rails
 
JS & NodeJS - An Introduction
JS & NodeJS - An IntroductionJS & NodeJS - An Introduction
JS & NodeJS - An Introduction
 
New paradigms
New paradigmsNew paradigms
New paradigms
 
JavaScript Engine and WebAssembly
JavaScript Engine and WebAssemblyJavaScript Engine and WebAssembly
JavaScript Engine and WebAssembly
 
Speed up your zombies! - Bootstrap dev environment in 5 minutes!
Speed up your zombies! - Bootstrap dev environment in 5 minutes!Speed up your zombies! - Bootstrap dev environment in 5 minutes!
Speed up your zombies! - Bootstrap dev environment in 5 minutes!
 
React Native.pptx (2)
React Native.pptx (2)React Native.pptx (2)
React Native.pptx (2)
 
Building Native Android Apps with JavaScript
Building Native Android Apps with JavaScriptBuilding Native Android Apps with JavaScript
Building Native Android Apps with JavaScript
 
Gatsby vs. Next.js
Gatsby vs. Next.jsGatsby vs. Next.js
Gatsby vs. Next.js
 
Nodeconf npm 2011
Nodeconf npm 2011Nodeconf npm 2011
Nodeconf npm 2011
 
Clojure Lightning Talk
Clojure Lightning TalkClojure Lightning Talk
Clojure Lightning Talk
 
Bindings dojo
Bindings dojoBindings dojo
Bindings dojo
 

Similar to Hybrid Application Development

Lightning fast sass
Lightning fast sassLightning fast sass
Lightning fast sass
chriseppstein
 
WordPress automation and CI
WordPress automation and CIWordPress automation and CI
WordPress automation and CI
Ran Bar-Zik
 
Node.js an Exectutive View
Node.js an Exectutive ViewNode.js an Exectutive View
Node.js an Exectutive View
Manuel Eusebio de Paz Carmona
 
Confoo - Javascript Server Side : How to start
Confoo - Javascript Server Side : How to startConfoo - Javascript Server Side : How to start
Confoo - Javascript Server Side : How to start
Quentin Adam
 
Nodejs
NodejsNodejs
Nodejs
dssprakash
 
The future of server side JavaScript
The future of server side JavaScriptThe future of server side JavaScript
The future of server side JavaScript
Oleg Podsechin
 
NodeWay in my project & sails.js
NodeWay in my project & sails.jsNodeWay in my project & sails.js
NodeWay in my project & sails.js
Dmytro Ovcharenko
 
DSLs in JavaScript
DSLs in JavaScriptDSLs in JavaScript
DSLs in JavaScript
elliando dias
 
Nodejs
NodejsNodejs
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sails
Brian Shannon
 
Java script anywhere. What Nombas was doing pre-acquisition.
Java script anywhere. What Nombas was doing pre-acquisition.Java script anywhere. What Nombas was doing pre-acquisition.
Java script anywhere. What Nombas was doing pre-acquisition.
Brent Noorda
 
NodeJS and what is actually does
NodeJS and what is actually doesNodeJS and what is actually does
NodeJS and what is actually does
Victor Reyes Heitmann
 
Once upon a time, there were css, js and server-side rendering
Once upon a time, there were css, js and server-side renderingOnce upon a time, there were css, js and server-side rendering
Once upon a time, there were css, js and server-side rendering
Andrea Giannantonio
 
Treinamento frontend
Treinamento frontendTreinamento frontend
Treinamento frontend
Adrian Caetano
 
An overview of node.js
An overview of node.jsAn overview of node.js
An overview of node.js
valuebound
 
Difference between Node.js vs Java script
Difference between Node.js vs Java scriptDifference between Node.js vs Java script
Difference between Node.js vs Java script
GhulamHussain799241
 
Java Script recruiting
Java Script recruitingJava Script recruiting
Java Script recruiting
Ihor Odynets
 
HTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use TodayHTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use Today
Todd Anglin
 
Isomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master ClassIsomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master Class
Spike Brehm
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Malla Reddy University
 

Similar to Hybrid Application Development (20)

Lightning fast sass
Lightning fast sassLightning fast sass
Lightning fast sass
 
WordPress automation and CI
WordPress automation and CIWordPress automation and CI
WordPress automation and CI
 
Node.js an Exectutive View
Node.js an Exectutive ViewNode.js an Exectutive View
Node.js an Exectutive View
 
Confoo - Javascript Server Side : How to start
Confoo - Javascript Server Side : How to startConfoo - Javascript Server Side : How to start
Confoo - Javascript Server Side : How to start
 
Nodejs
NodejsNodejs
Nodejs
 
The future of server side JavaScript
The future of server side JavaScriptThe future of server side JavaScript
The future of server side JavaScript
 
NodeWay in my project & sails.js
NodeWay in my project & sails.jsNodeWay in my project & sails.js
NodeWay in my project & sails.js
 
DSLs in JavaScript
DSLs in JavaScriptDSLs in JavaScript
DSLs in JavaScript
 
Nodejs
NodejsNodejs
Nodejs
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sails
 
Java script anywhere. What Nombas was doing pre-acquisition.
Java script anywhere. What Nombas was doing pre-acquisition.Java script anywhere. What Nombas was doing pre-acquisition.
Java script anywhere. What Nombas was doing pre-acquisition.
 
NodeJS and what is actually does
NodeJS and what is actually doesNodeJS and what is actually does
NodeJS and what is actually does
 
Once upon a time, there were css, js and server-side rendering
Once upon a time, there were css, js and server-side renderingOnce upon a time, there were css, js and server-side rendering
Once upon a time, there were css, js and server-side rendering
 
Treinamento frontend
Treinamento frontendTreinamento frontend
Treinamento frontend
 
An overview of node.js
An overview of node.jsAn overview of node.js
An overview of node.js
 
Difference between Node.js vs Java script
Difference between Node.js vs Java scriptDifference between Node.js vs Java script
Difference between Node.js vs Java script
 
Java Script recruiting
Java Script recruitingJava Script recruiting
Java Script recruiting
 
HTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use TodayHTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use Today
 
Isomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master ClassIsomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master Class
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
 

Hybrid Application Development

  • 1. Using Jade, Stylus and NodeJS Together with Grunt Hybrid App Development Yagiz Nizipli Software Engineer
  • 2. My Past Computer engineer, musician, geek. But what have I really been doing for the past 2 years?
  • 3. Open-Source Initiative ❖ Always a fan of open-source projects. ❖ github.com/anonrig
  • 4. Grunt - The Javascript Task Runner ❖ Automation ❖ Minification, unit testing, linting ❖ Test-driven programming ❖ Step by step compilation
  • 5. Using NodeJs with Grunt ❖ Node.js is an event-driven, non-blocking i/o solution for asynchronous application development. ❖ On top of the language Javascript. ❖ An example use for Nodejs with Grunt is using file stream library in Nodejs. ❖ Require it using: var fs = require('fs');
  • 6. An example page for our mobile application <head> <title>My Application</title> … some meta tags here … <stylesheets/> </head> <body> <script type=“text/javascript”> myEnvironmentVariable = {}; <environment/> </script> </body>
  • 7. ❖ Local, test and production web: { input:"www/index.html", output:"www/index.html", tokens: [{ token: "<environment/>", string: fs.readFileSync('src/config/web.js').toString() }] }, test: { input: "www/index.html", output: "www/index.html", tokens: [{ token: "<directives/>", string: fs.readFileSync('src/config/test.js').toString() }] }, prod: { input: "www/index.html", output: "www/index.html", tokens: [{ token: "<directives/>", string: fs.readFileSync('src/config/prod.js').toString() }] }
  • 8. Why we need a template engine? ❖ Don’t waste time on markup languages. ❖ Reuse the code whenever it’s possible. ❖ Indentation is the key point. ❖ Use if compilation is inevitable.
  • 9. Introducing Jade ❖ Jade, accessed from jade-lang.com, is a node template engine for HTML5 and JavaScript. ❖ Enables us to use HTML without the markup functionality. ❖ Compiles Jade code to HTML5 and JS. ❖ How?
  • 10. An example Jade code Jade HTML5
  • 11. Introducing Stylus ❖ Stylus, defined by the developers, is a expressive, robust, feature-rich CSS preprocessor. ❖ CSS without the unnecessary syntax. ❖ Enables to reuse the same CSS code for multiple rules. ❖ How?
  • 12. Example Stylus code An everyday stylus use Using Stylus with setting variables body font 12px Helvetica, Arial, sans-serif a.button -webkit-border-radius 5px -moz-border-radius 5px border-radius 5px fonts = helvetica, arial, sans-serif body padding 50px font 14px/1.4 fonts
  • 13. What now? ❖ How to compile these engines without knowing? ❖ That’s why we need Grunt. ❖ Grunt offers grunt-contrib-stylus and grunt-contrib-jade tasks to compile both of these engines.
  • 14. An example of Grunt file grunt.initConfig({ clean: { before: ['www/img', 'www/css', 'www/compiled'] }, jade: { compile: { options: { pretty: true, data: { debug: true } }, files: [{ cwd: "src", src: "**/*.jade", dest: "www", expand: true, ext: ".html" }] } }, stylus: { build: { options: { linenos: false, compress: true }, files: [{ expand: true, cwd: 'src/css', src: [ '**/*.styl' ], dest: 'www/css', ext: '.css' }] } }, });
  • 15. Sample project demo ❖ github.com/anonrig/istanbul-coders