GithubHelp home page GithubHelp logo

t7-precompiler's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

t7-precompiler's Issues

Webpack and t7-precompiler

Hey,

How this t7-precompiler is supposed to be used with webpack? I made simple t7-precompiler module that looks like this.

"use strict";

let compiler = require('t7-precompiler');

module.exports = function (source) {
    try {
        return compiler.compile(source, 'inferno');
    } catch (e) {
        throw new Error(e);
    }
};

As you can see I'm trying to precompile sources for inferno, but I'm unable to get this working. Sources are compiled, but compiled output doesn't do anything.

source:

var t7 = require('t7');
t7.setPrecompile(true);

...


    t7.module(function (t7) {
        class Component extends Inferno.Component {
            constructor(props) {
                super(props);
                this.state.counter = 0;
            }

            render() {
                return t7`
                    <div>
                      <h1>Header!</h1>
                      <span>Counter is at: ${ this.state.counter }</span>
                    </div>
                  `;
            }
        }

        t7.assign("Component", Component);
        Inferno.render(t7`<Component />`, APP_ELEMENT);
    });

Compiles into:

        t7.module(function (t7) {
            var Component = (function (_Inferno$Component) {
                _inherits(Component, _Inferno$Component);

                function Component(props) {
                    _classCallCheck(this, Component);

                    var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Component).call(this, props));

                    _this.state.counter = 0;
                    return _this;
                }

                _createClass(Component, [{
                    key: 'render',
                    value: function render() {
                        return t7.precompile([this.state.counter, { template: __nbWeX, templateKey: -938833914, components: null }]);
                    }
                }]);

                return Component;
            })(_inferno2.default.Component);

            t7.assign("Component", Component);
            _inferno2.default.render(t7.precompile([{ template: __fxTFw, templateKey: -759185842, components: null }]), _dom.APP_ELEMENT);

When debugging: t7.precompile(****) doesn't return anything and If I look into source I can see this is empty function so it just returns undefined and ignores parameters. How is this supposed to be used?

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.