Giter Club home page Giter Club logo

Comments (7)

rcrowe avatar rcrowe commented on August 22, 2024

There's some big issues with the compile command.

I've hit the same issues; it's something I'm looking at fixing with the
next release.

On Friday, 7 June 2013, Ivรกn N. Paz wrote:

When trying to precompile the twig templates:

$ php artisan twig:compile

The process breaks with:

[InvalidArgumentException]
View [home/main.html] not found.

Extra info:

  • The twig views follow the"$viewname.html.twig" convention
  • The config.php for the TwigBridge specifies the extension as: 'extension'
    => 'html.twig'
  • The views load perfectly fine on site, this issue only happens with
    the compile command.

โ€”
Reply to this email directly or view it on GitHubhttps://github.com//issues/41
.

from twigbridge.

rcrowe avatar rcrowe commented on August 22, 2024

So started looking at this again. I just can't see how we can make this command actually work.

The current implementation of the compile just can't work. It uses Laravel to load the view without any data which means functions, etc are likely to just fall over.

It's likely that this command is going to be dropped unless someone has a fix for this?

from twigbridge.

ivannpaz avatar ivannpaz commented on August 22, 2024

I believe it can be done without having to launch the view rendering via Laravel (not 100% sure though). According to http://twig.sensiolabs.org/doc/internals.html you can tokenize the views as such, which in the end will call the actual methods/varianles you inject into them. I believe this is as far as you can go on compiling the views... Anything else above this I believe it would onto Varnish or smth like that. Again, not 100% sure about this, I`ll get a closer look coming weeks.

from twigbridge.

rcrowe avatar rcrowe commented on August 22, 2024

Hopefully this works out. It essentially does what you said, but after looking at it I realised I was being stupid, there really was no need to call render.

I've committed this to master and will tag later if no issues arise.

from twigbridge.

rcrowe avatar rcrowe commented on August 22, 2024

Scrap that, not working quite right. Correct way to go about it but the implementation is slightly off.

It's generating the compiled template, however the name/file is different to that generated when called through the web. Effectively meaning currently the compile is useless.

I don't really have the time at the moment to look at this issue, maybe someone else can take this on?

from twigbridge.

rcrowe avatar rcrowe commented on August 22, 2024

Just pushed a revised twig:compile command to 0.6. Let me know of any issues.

from twigbridge.

rcrowe avatar rcrowe commented on August 22, 2024

Looks like Laravels optimize command supports the ability to pre-compile views. Currently TwigBridge doesn't support this.

Once this is implemented the separate twig:compile is likely to disappear.

from twigbridge.

Related Issues (20)

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.