Norwegian Parcel Mail

    @tarik02/bladejs-compiler
    TypeScript icon, indicating that this package has built-in type declarations

    3.0.0 • Public • Published

    bladejs-compiler

    TravisCI Build Status AppVeyor Build Status npm version

    Installation

    $ yarn add @tarik02/bladejs-compiler
    # or
    $ npm install --save @tarik02/bladejs-compiler

    Usage

    import {
      AbstractError,
      Compiler,
      Source,
    } from '@tarik02/bladejs-compiler';
    
    const compiler = new Compiler();
    compiler.addDefaults();
    
    const source = `
    <div class="alert alert-danger">
        <div class="alert-title">{{ title }}</div>
    
        {{ slot }}
    </div>
    `.trim();
    const filename = 'test.bjs';
    
    const source = new Source(source, filename);
    let compiled: string;
    
    try {
      compiled = compiler.compile(source);
    } catch (e) {
      if (e instanceof AbstractError) {
        process.stdout.write(e.prettyPrint());
        process.exit(-1);
      }
    
      throw e;
    }

    Install

    npm i @tarik02/bladejs-compiler

    DownloadsWeekly Downloads

    2

    Version

    3.0.0

    License

    MIT

    Unpacked Size

    230 kB

    Total Files

    132

    Last publish

    Collaborators

    • tarik02