dragonnodejs-webserver
v9.1.1
Published
Bundle with services to develop serverside rendered applications with swig
Downloads
11
Readme
DragonNode.js Webserver
Bundle with services to develop applications with express, bower and swig
- Provide the versions of the bower installed libraries in the views
- Provide the language data with the determined language in the views
- Provide the information of the package.json in the views
- Swig express integration to bind ".twig" views to the swig renderer
Installation
- Add bundle to the "package.json":
{
"dependencies": {
"dragonnodejs-webserver": "^9.1.1"
}
}- Run "npm install"
- Extend the configuration in "app.js":
var config = {
modules: {
npm: [
[require('dragonnodejs-webserver'), {
bower: {
libraries: [],
path: __dirname + '/'
},
language: {
default: 'en',
languages: ['de', 'en'],
path: __dirname + '/languages/'
},
package: {
path: __dirname + '/package.json'
},
swig: {
views: __dirname + '/views/'
}
}]
]
}
};Reserved Swig variables
- "bower" with the versions of the bower installed libraries, for example to include jQuery per dynamic CDN URL:
<script src="//ajax.googleapis.com/ajax/libs/jquery/{{ bower.jquery }}/jquery.min.js"></script>- "language" with the language strings if the language service is used in the current request
{{ language.example }}- "package" with the name and the version of the application from the "/package.json", for example:
{{ package.name }} {{ package.version }}