Coder Social home page Coder Social logo

handlebars-project-template's Introduction

handlebars template

Using webpack with handlebars-loader

Instructions

Create page

  1. Register route in "pages.config.ts".
  2. Create a folder in src/pages directory, naming it with the same name you register in pages.config.ts.
  3. Basically, you may need index.hbs(template), index.ts(script), style.scss(style) files in your page fold
  • index.hbs: use handlebars partials and helpers to build your html template
  • index.ts: import the script using in the partials, or import some third party library plugins
  • style.scss: import the style you need for template

Create partials (components)

  1. Create a partial folder in src/partials directory
  2. In your partial folder, you can also create index.hbs(template), index.ts(script), style.scss(style) file like page folders
  3. To let your partial with hot reload in development mode, registering your .hbs file to src/partials/registerHotReload.ts
  4. Remeber to import index.ts and style.scss in the page which is using the partial

Others

tsconfig.buildHelper.json is only for src/helpers/*.ts

  • Handlebars helpers can only refer to .js files, so its .ts files should be compile before using. In this project, we use tsc command to compile ts files to js files in src/helpers/dist.
  • The other ts files will be handle by webpack

handlebars-project-template's People

Contributors

link1515 avatar

Watchers

 avatar

Forkers

link1522

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.