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

nap

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nap - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

perf_test.coffee

4

package.json
{
"name": "nap",
"version": "0.3.1",
"version": "0.3.2",
"author": "Craig Spaeth <craigspaeth@gmail.com> (http://craigspaeth.com)",

@@ -22,3 +22,3 @@ "description": "Compile and package your assets including stylesheets, javascripts, and client-side javascript templates for node.js",

"dependencies": {
"coffee-script": "~1.2",
"coffee-script": "*",
"underscore": "*",

@@ -25,0 +25,0 @@ "underscore.string": "*",

# Node Asset Packager
(nap) Node Asset Packager helps compile and package your assets including stylesheets, javascripts, and client-side javascript templates.
(nap) Node Asset Packager helps compile, manage, & package stylesheets, javascripts, and javascript templates for node.js.

@@ -75,3 +75,3 @@ ## Example

To make things easy nap assumes you have a */public* folder (like an Express.js or Ruby on Rails public folder) so that nap can generate & reference assets inside */public/assets*.
To make things easy nap assumes you have a */public* folder to serve static assets (like an Express.js or Ruby on Rails public folder) so that nap can generate & reference assets inside */public/assets*.

@@ -133,17 +133,43 @@ Simply pass a set of options to the main `nap` function to configure your asset packages. Then use one of nap's helpers (`nap.js('package-name')`, `nap.css('package-name')`, `nap.jst('package-name')`) to output `<script>` and `<style> ` tags into your server-side templates.

Nap currently only supports the following pre-processors. But please feel free to contribute more.
Nap currently only supports the following pre-processors by default. But please feel free to contribute more.
* [Coffeescript](http://jashkenas.github.com/coffee-script/) (.coffee)
* [Stylus](https://github.com/LearnBoost/stylus) (.styl)
### Adding your own preprocessors
You can add your own preprocessors to nap by extending `nap.preprocessors`, with a fileExtension: preprocessFunction pair.
e.g.
````javascript
var nap = require('nap')
, coffee = require('coffee-script');
nap.preprocessors['.coffee'] = function(contents) { return coffee.compile(contents) };
````
## Client-side Javascript Templating (JSTs)
*jst* packages will run the appropriate template engine parser based off the file extension. Nap will then namespace your client-side templates into a global `JST['file/path']` function, much like [Jammit](http://documentcloud.github.com/jammit/#jst). The namespace is the directory following *templates* without the file extension.
*jst* packages will run the appropriate template parser based off the file extension. Nap will then namespace your client-side templates into a global `JST['file/path']` function, much like [Jammit](http://documentcloud.github.com/jammit/#jst). The namespace is the directory following *templates* without the file extension.
e.g. The template *app/templates/artwork/detail.jade* will be parsed using jade and can be rendered on the client-side by calling `JST['artwork/detail']({ title: 'Mona Lisa' })`
Nap currently only supports the following templating engines. But please feel free to contribute more.
Nap currently only supports the following template parsers by default. But please feel free to contribute more.
* [Jade](https://github.com/visionmedia/jade) (.jade)
### Adding your own template parsers
You can add your own template parsers to nap by extending `nap.templateParsers`, with a fileExtension: templateParserFunction pair.
e.g.
````javascript
var nap = require('nap')
, jade = require('jade');
nap.templateParsers['.jade'] = function(contents) {
return jade.compile(contents, { client: true, compileDebug: true });
};
````
## Nap Modes

@@ -181,6 +207,6 @@

Nap uses [Mocha](https://github.com/visionmedia/mocha) for testing. Simply run the mocha with coffeescript command to run tests.
Nap uses [Mocha](https://github.com/visionmedia/mocha) for testing, simply run `mocha`.
````
mocha --compilers coffee:coffee-script
mocha
````

@@ -187,0 +213,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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