ConstexprJS API Documentation

Top

ConstexprJS compiler injects some methods in the runtime of a page which the rendering code can use to coordinate/manipulate the behaviour of the compiler. This page describes these methods.

  • window._ConstexprJS_.compile()

    The rendering code should call this method once it has finished rendering. The tab will be snapshotted and closed.

  • window._ConstexprJS_.abort(message)

    Call this method if you want the compiler to skip this page. The tab will be closed.

  • window._ConstexprJS_.addPath(path)

    Use this method to tell the compiler that it needs to generate additional HTML files in the output directory. This method doesn't affect the current page in any way. See this page for detailed documentation.

  • window._ConstexprJS_.addExclusion(path)

    After the compiler has rendered a page, it extracts the list of resources used by the page by looking at the DOM. It includes all local images, media, stylesheets, and favicons in the dependency list of the page. You can use this method to exclude a resource from being included in the dependencies list of this page which would have been included otherwise. It won't be copied to the output directory.

  • window._ConstexprJS_.addDependency(path)

    Include a local resource in the dependencies list of this page. It will be copied to the output directory. This method takes precedence over addExclusion. Use it for resources which aren't detected by the automatic dependency resolution system. For example fonts, SASS/LESS source maps, assets included with CSS.

See pages tagged with constexprjs for more guides.