Giter Club home page Giter Club logo

polymer-bundle's Introduction

Polyphonic Polymer Bundle

Symfony bundle and Twig extension for developing and deploying Polymer web components.

Build Status Documentation MIT License

Polyphonic Symfony

This bundle is no where near production ready. Use at your own risk.

The purpose of this bundle is making it easier to use and build Polymer web components within a Symfony project. Polyphonic handles the problems that come up when trying to build and use web components within Twig templates.

Example Element

A simple example of using the {% polymer element %} Twig tag to create a custom <hello-world><hello-world> element. This element displays "Hello, World!" by default, but the message can be changed by setting the name attribute.

Note that there's no need to add <link rel="import" href="polymer/polymer.html"> as the import statement is added automatically. The template is saved in the bundle directory at Resources/public/elements/hello-world/hello-world.html.twig.

{% polymer element "hello-world" attributes="name" %}
    <template>
        <p>Hello, {{name}}!</p>
    </template>
    <script>
        Polymer({
            name: "World"
        });
    </script>
{% endpolymer %}

Using the element in your views:

{% polymer import "@AcmeBundle:hello-world/hello-world.html.twig" %}

<!-- Displays "Hello, World!" -->
<hello-world></hello-world>

<!-- Displays "Hello, Pascal!" -->
<hello-world name="Pascal"></hello-world>

Requirements

PHP 5.5.*
Symfony 2.6.*

Installing

Add headzoo/polymer-bundle to your composer.json requirements.

"require": {
    "headzoo/polymer-bundle": "0.0.3"
}

Run composer update and then add the bundle your AppKernel.php.

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            ...
            new Headzoo\Bundle\PolymerBundle\PolymerBundle(),
        )
        
        return $bundles;
    }
}

Add the following route to your app/config/routing_dev.yml file.

polymer:
	resource: "@PolymerBundle/Resources/config/routing.yml"
	prefix:   /_polymer

Next: Read the full documentation

polymer-bundle's People

Contributors

headzoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

polymer-bundle's Issues

You have requested a non-existent parameter "twig.options".

Hi,

I'm trying to use the bundle but I'm getting this message:

ParameterNotFoundException in ParameterBag.php line 106: You have requested a non-existent parameter "twig.options". in ParameterBag.php line 106 at ParameterBag->get('twig.options') in bootstrap.php.cache line 2047 at Container->getParameter('twig.options') in PolymerExtension.php line 105 at PolymerExtension->setupTwig(object(ContainerBuilder)) in PolymerExtension.php line 40 at PolymerExtension->load(array(array('debug' => true, 'auto_verbatim' => true, 'twig' => array('tag' => 'polymer', 'templates' => array('element' => 'PolymerBundle:polymer:element.html.twig', 'import' => 'PolymerBundle:polymer:import.html.twig')), 'paths' => array('elements' => 'elements', 'components' => 'bower_components'))), object(ContainerBuilder)) in MergeExtensionConfigurationPass.php line 55 at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in MergeExtensionConfigurationPass.php line 39 at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in Compiler.php line 117 at Compiler->compile(object(ContainerBuilder)) in ContainerBuilder.php line 614 at ContainerBuilder->compile() in bootstrap.php.cache line 2617 at Kernel->initializeContainer() in bootstrap.php.cache line 2395 at Kernel->boot() in bootstrap.php.cache line 2426 at Kernel->handle(object(Request)) in app_dev.php line 28

The twig.options is used in PolymerExtenions->setupTwig. Please anyone knows how to help me.

Sorry for my English.

=)

Whats next

I would like to help you move this forward. Whats next? How do we collaborate?

Symfony lock on 2.6.*

Can you please change your composer.json file to allow for a rational symfony constraint. I don't know why it is explicitly 2.6, but if, perhaps you are relying on features, specific to that release, a constraint of >=2.6 or even (though I'd prefer not) ~2.6,>=2.6 would be much more appropriate.

I'd really like to use this bundle in a few projects, and forking it simply to change the composer constraint (and then having to make sure I'm keeping my fork up to date with your upstream repo) seems...like a waste of time, and generally useless exercise. ;-)

BTW: This thing looks amazing, and from playing around with it on a fresh install of 2.6 (just to see how it behaved), it's a solid implementation.

No symfony 3 compatibility

It would be great to avoid use of this cool stuff on symfony3. No symfony3 - polymer integration possible now

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.