Skip to content
This repository has been archived by the owner on Sep 21, 2020. It is now read-only.

Need a fast template development environment? You're in the right place ^_^

License

Notifications You must be signed in to change notification settings

gurkanbicer/node-template-dev-env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-template-dev-env

Need a fast template development environment? You're in the right place ^_^

You will have these when using it;

  • Twig Template Engine
  • SASS to CSS Compiler

Installation

1- Clone the repo;

git clone https://github.com/gurkanbicer/node-template-dev-env.git

2- Install packages;

npm install

3- Run;

npm start

Documentations

Knowledge

When you need create an another page, you should write your code into routes/index.js file. Here an example;

router.get('/books', function (req, res) {
  const params = {
    title: 'Page: /books',
    books: [
      {"name" : "Hello World!"}, 
      {"name" : "Hello JS!"}
    ]};
  res.render('books', params, function (err, output) {
    writeOutputToDist(req.path, output);
    res.send(output);
  });
});

Then, create a twig file into views directory.

<h1>{{ title}}</h1>
<ul>
    {% for book in books %}
        <li>{{ book.name }}</li>
    {% endfor %}
</ul>

Just, open the browser and check it. Your's default url is https://localhost:3000

Default Directories and Files
  • Assets directory: public/assets
  • Dist (output) directory: public/dist
  • Views directory: views
  • Route file: routes/index.js
  • Config file: .env
Build Command

You should run the project before use it;

npm run build-dist

When use this command public/dist directory will be emptied and re-generated.

For further information please contact or create an issue.