Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
derby-jade
Advanced tools
:
and makes if, else, else if, unless, with, each
compile into derby View-variablesnpm install derby-jade
app.serverUse(module, 'derby-jade');
// before app.loadViews();
If you want to use Coffeescript instead of Javascript in templates:
app.serverUse(module, 'derby-jade', {coffee: true});
Then you can do something like this:
if a and b
p
a(on-click="console.log c or 'log'") {{d or 'Click Me'}}
script.
here = canbe + coffee and script
each
, with
if _session.loggedIn
h1 Hello, {{_session.username}}
else
a(href='/login') Login
compiles to
{{if _session.loggedIn}}
<h1>Hello, {{_session.username}}</h1>
{{else}}
<a href="/login">Login</a>
{{/}}
Another example:
if _page.flash as #flash
if #flash.error
ul.alert.alert-error
each #flash.error
li {{this.error}}
if #flash.info
ul.alert.alert-success
each #flash.info as #info
li {{#info}}
else
p No notifications
compiles to
{{if _page.flash as #flash}}
{{if #flash.error}}
<ul class="alert alert-error">
{{each #flash.error}}
<li>{{this.error}}</li>
{{/}}
</ul>
{{/}}
{{if #flash.info}}
<ul class="alert alert-success">
{{each #flash.info as #info}}
<li>{{#info}}</li>
{{/}}
</ul>
{{/}}
{{else}}
<p>No notifications</p>
{{/}}
import:
and template declarationsimport:(src='./auth', ns='')
import(src='./games')
Title:
| My cool app
Body
view(name='welcome', title='Welcome {{_session.username}}')
p We are glad to see you!
Footer:
view(name='copyright')
welcome
h1 {{@title}}
| {{@content}}
copyright:
p Use it however you want {{_session.username}}!
import(src='./home', ns='home')
import:(src='./about')
Body:
each _page.users as #user
if #user && #user.id
a(on-click='click(#user && #user.id)') {{#user && #user.name}}
else if #user || #user.id
p {{#user.id}}
else
p nothing
view(name='{{#user.id || #user.name}}')
p {{unescaped #user.name}}
p
script.
window.scrollTo(0 || 1, 0 && 1)
//script.
window.location = window.location
p
script.
history.go(-2)
// p bla-bla
script history.go(2)
script(src='/script.js')
script.
history.go(1)
component
p {{@name}}
if _page.name || @name && this.field
div {{show(@name)}}
script.
history.go(0)
input
p a
index:
layout:body
view(name="matches-you-liked")
matches-you-liked:
h1 Matches you liked
import(src='./home', ns='home')
import:(src='./about')
Body:
each _page.users as #user
if #user and #user.id
a(on-click='click #user and #user.id') {{#user and #user.name}}
else if #user or #user.id
p {{#user.id}}
else
p nothing
view(name='{{#user.id or #user.name}}')
p {{unescaped #user.name}}
p
script.
window.scrollTo 0 or 1, 0 and 1
//script.
window.location = window.location
p
script.
history.go -2
// p bla-bla
script history.go 2
script(src='/script.js')
script.
history.go 1
component
p {{@name}}
if _page.name or @name and @.field
div {{show @name}}
script.
history.go 0
input
p a
index:
layout:body
view(name="matches-you-liked")
matches-you-liked:
h1 Matches you liked
<import: src="./home" ns="home">
<import: src="./about">
<Body:>
{{each _page.users as #user}}
{{if #user && #user.id}}<a on-click="click(#user && #user.id)">{{#user && #user.name}}</a> {{else if #user || #user.id}}
<p>{{#user.id}}</p>
{{else}}
<p>nothing</p>
{{/}}
<view name="{{#user.id || #user.name}}"></view>
<p>{{unescaped #user.name}}</p>
{{/}}
<p>
<script>
window.scrollTo(0 || 1, 0 && 1)
</script>
<p>
<script>
history.go(-2)
</script>
</p>
</p>
<script>history.go(2)</script>
<script src="/script.js"></script>
<script>
history.go(1)
</script>
<component:>
<p>{{@name}}</p>
{{if _page.name || @name && this.field}}
<div>{{show(@name)}}</div>
{{/}}
<script>
history.go(0)
</script>
<input:>
<p>a</p>
<index:>
<layout:body>
<view name="matches-you-liked"></view>
</layout:body>
<matches-you-liked:>
<h1>Matches you liked</h1>
FAQs
Jade for Derby.js
The npm package derby-jade receives a total of 9 weekly downloads. As such, derby-jade popularity was classified as not popular.
We found that derby-jade demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.