Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

docpad-plugin-coffeemugg

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docpad-plugin-coffeemugg

Adds support for CoffeeMugg compilation to DocPad

  • 2.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

CoffeeMugg Plugin for DocPad

Build Status NPM version Gittip donate button

Adds support for CoffeeMugg to HTML compilation to DocPad

Convention: .html.coffee

Advantages over docpad-plugins-coffeekup:

  • can use nodejs libraries i.e. require
  • can create global custom tags via config or nodejs module
  • clean debug code

Install

npm install --save docpad-plugin-coffeemugg

##Example usage

# templateData and docpad variables are accessed via @context

@div ->
	@p "I am a paragraph"
	@raw "<p> This is unescaped, raw HTML </p>"
	@text "<< This will be escaped ! >>"

Coffeemuggs methods are all in the @\this scope so to obtain the docpad object or templateData etc.. you can use

@context.docpad 
@templateData
@content
@document
@documentModel

When using a plugin like docpad-plugin-partials and you want to pass the context you should only pass the template data

partial('my-partial', false, {@templateData} )

Configure

Compress

By default we compress the output for all environments except the development environment. Set the format option to either true or false to change this (true formats nicely, false compresses).

Available Options

plugins:
	coffeemugg:
		options:
			# The output HTML will be formatted all pretty. 
			# **Default: false**
			format:		false
			
			# The "text" values are automatically HTML escaped. 
			# **Default: true** (use '@raw' tag for unescaped text.)
			autoescape: true
			
			# Array of plugins
			# They are functions that take a context as argument 
			# or can be strings that will be passed to require()
			plugins:	[]	

Plugin Config Examples

Can be an array of functions or require() locations

[
	(context) ->
		context["showFruits"] = (fruits) ->
			@ul ->
				for fruit in fruits
					@li fruit

	"src/code/mytag" # would specify require("src/code/mytag")
]

Plugins in separate files and to be loaded via require should be exported in the usual nodejs fashion:

module.exports =
	(context) ->
		context["showFruits"] = (fruits) ->
			@ul ->
				for fruit in fruits
					@li fruit

History

You can discover the history inside the History.md file

Contributing

You can discover the contributing instructions inside the Contributing.md file

License

Licensed under the incredibly permissive MIT License
Copyright © 2013+ Stringz Solutions Ltd
Copyright © 2013+ Peter Flannery

Keywords

FAQs

Package last updated on 08 Nov 2013

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc