Git Product home page Git Product logo

template-compiler's Introduction

Squarespace Template Compiler.

A Java template compiler based on JSON-Template.

Build Status Coverage Status

License: Apache 2.0 (summary)

Copyright (c) 2014 SQUARESPACE, Inc.

Overview

Squarespace's template language is based on JSON-Template, a minimal declarative template language for Python and JavaScript, heavily influenced by google-ctemplate.

Objectives

The project was started with these objectives:

  • Move away from using Node.js for backend template compilation.
  • Must meet or exceed performance of the legacy system. The compiler can potentially execute several times for each page view, so it needs to be really fast.
  • Improve performance over the legacy system.
  • Minimize memory usage. For example, parsing can often create and discard a high number of temporary strings.
  • Support additional features for server-side compilation.
  • High test coverage.
  • Support syntax error recovery.
  • Support a template validation mode.

Measured Results

  • Average 20x performance increase over previous Node.js + JSON-Template system.

template-compiler's People

Contributors

amartacus avatar clin26 avatar david-xiang-sqsp avatar georgezzhang avatar gesu avatar hbathlasqsp avatar helenzhangg avatar jasonbl avatar jaywritescode avatar jmariconda avatar jshimizu-sqsp avatar kelvin-d-zhu avatar kllewellyn avatar ksliao avatar marcoangulo avatar mcase-sqsp avatar melias-sqsp avatar nhassan avatar pavel-sqsp avatar phensley avatar rohan51 avatar sizhang12 avatar skong avatar suhuitan avatar summermin avatar

Stargazers

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

Watchers

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

template-compiler's Issues

Local server doesn't work

Hi team, not sure about right place for report this issues but looks like here. Sorry if mistaken.

Just look around possibilities of this platform and want to make custom template for customer.
just installed server and throw error

Platform: win10
Possibly it can be policy rules but looks like on another machine the same issue..

off
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/temp/template/node_modules/@squarespace/server/build/distributions/local-developer/lib/logback-classic-1.1.3.jar!/org/slf4j/impl/StaticLoggerBinder.c
lass]
SLF4J: Found binding in [jar:file:/D:/temp/template/node_modules/@squarespace/server/build/distributions/local-developer/lib/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.c
lass]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
02:39:20,867 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
02:39:20,867 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
02:39:20,868 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/D:/temp/template/node_modules/@squarespace/server/build/distributions/loc
al-developer/lib/local-developer.jar!/logback.xml]
02:39:20,868 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath.
02:39:20,868 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/D:/temp/template/node_modules/@squarespace/server/build/distributions/lo
cal-developer/lib/local-developer.jar!/logback.xml]
02:39:20,868 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/D:/temp/template/node_modules/@squarespace/server/build/distributions/lo
cal-developer/lib/src.jar!/logback.xml]
02:39:20,878 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@c038203 - URL [jar:file:/D:/temp/template/node_modules/@squarespace/server/build/distributions/local-developer/
lib/local-developer.jar!/logback.xml] is not of type file
02:39:20,910 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
02:39:20,921 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
02:39:20,926 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
02:39:20,952 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
02:39:20,974 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [__RequestLogger] to INFO
02:39:20,974 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.squarespace.developer.autoreload.ReloadFileWatcher] to INFO
02:39:20,974 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [io.dropwizard.server.ServerFactory] to INFO
02:39:20,974 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to ERROR
02:39:20,974 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
02:39:20,975 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
02:39:20,975 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@cc285f4 - Registering current configuration as safe fallback point

SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
Exception in thread "main" java.lang.NoSuchMethodError: io.dropwizard.server.SimpleServerFactory.setRequestLogFactory(Lio/dropwizard/request/logging/RequestLogFactory;)V
        at com.squarespace.developer.DevelopmentServer.configureLogging(DevelopmentServer.java:117)
        at com.squarespace.developer.DevelopmentServer.run(DevelopmentServer.java:73)
        at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:40)
        at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:77)
        at io.dropwizard.cli.Cli.run(Cli.java:70)
        at io.dropwizard.Application.run(Application.java:80)
        at com.squarespace.developer.DevelopmentServer.main(DevelopmentServer.java:61)
error Command failed with exit code 1.

Globally the same issue

Please help or advice where better report this problem.

Thanks in advance.

Adding Squarespace's dictionary to the compiler

Hey, I've been playing with the compiler and it seems to work OK if I give it the Squarespace template file and its corresponding JSON, but it's returning errors on Squarespace-specific tags like {.main-image?}, {.equal?, etc. Have you guys open sourced your dictionary as well?

tab-indented json (.conf) files fail silently

I was trying to figure out for almost an hour why no index entry would show up in the "create new page" menu after adding collections/index.conf, until I realized that the only difference was that I used tabs instead of spaces for indentation.

Apparently the compiler doesn't accept \t as valid whitespace? Would be nice to make that possible, and I would have at least expected an info about that in the docs or/and a warning/error message in the Settings/Advanced/Developer Mode menu (or dev server console). Things like this make Squarespace annoying to work with as a developer 😑

(excuse me if this is not the right repository to report this)

SyntaxError executing a template

When executing against template files/partials for a Squarespace site I get the following error:

SyntaxError PREDICATE_UNKNOWN at line 1 character 1085: Predicate \'folder?\' is unknown

I guess one question is whether this is fully ready to use on a Squarespace site template? The README doesn't have any information on usage. Any insights would be awesome :D

Instructions no how to build the project

Can you please write a quickstart guide on how to build the project?

I downloaded gradle, and if I try any of the following I get an error:

gradle tasks
gradle build

* What went wrong:
An exception occurred applying plugin request [id: 'net.researchgate.release', version: '2.0.2']
> Failed to apply plugin [class 'net.researchgate.release.GitReleasePlugin']
   > Could not find method leftShift() for arguments [org.codehaus.groovy.runtime.MethodClosure@7f48da5f] on task ':checkCommitNeeded' of type org.gradle.api.DefaultTask.

Much appreciated!

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.