Giter Site home page Giter Site logo

te-cho / compile-blades Goto Github PK

View Code? Open in Web Editor NEW
63.0 5.0 22.0 16 KB

For Laravel 5.* views, where i've noticed that if you nest too much views, a performance drop happens. so i built this console command based package, that flatten the view into one file for production performance improvement.

Home Page: https://packagist.org/packages/te-cho/compile-blades

License: MIT License

PHP 100.00%
laravel performance views blade blade-template flatten compile fast

compile-blades's People

Contributors

abidulrmdn avatar anirbanwgt 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  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

compile-blades's Issues

Restore/reset compiled blade

How you solve problem when you need to edit again your views files, so you need to restore back compiled files, make the edits, and then re-compile.

In my case, I have several views that use the same partials file, after I compile, I will have the same partials code inside multiple compiled files.

When I need to change, I would like to be able to reset compiled file and then make edit to single partials and re-compile again.

Could be possible to make a backup of compiled views.

Right now the content is replaced.

Thanks

Compatible with laravel 6

Can this be made compatible with laravel 6 and higher. Getting this error now. Would be awesome.
Thanks.

Problem 1
- Installation request for te-cho/compile-blades ^1.0 -> satisfiable by te-cho/compile-blades[v1.0].
- Conclusion: remove laravel/framework v6.18.26
- Conclusion: don't install laravel/framework v6.18.26
- te-cho/compile-blades v1.0 requires illuminate/view 5.0.|5.1.|5.2.|5.3.|5.4.* -> satisfiable by illuminate/view[5.0.x-dev, 5.1.x-dev, 5.2.x-dev, 5.3.x-dev, 5.4.x-dev, v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.33, v5.0.4, v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41, v5.1.6, v5.1.8, v5.2.0, v5.2.19, v5.2.21, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.31, v5.2.32, v5.2.37, v5.2.43, v5.2.45, v5.2.6, v5.2.7, v5.3.0, v5.3.16, v5.3.23, v5.3.4, v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9].

does not work with laravel 5.5 and above

I get this error when trying to require

Problem 1
- Installation request for te-cho/compile-blades ^1.0 -> satisfiable by te-cho/compile-blades[v1.0].
- Conclusion: remove laravel/framework v5.5.44
- Conclusion: don't install laravel/framework v5.5.44
- te-cho/compile-blades v1.0 requires illuminate/view 5.0.|5.1.|5.2.|5.3.|5.4.* -> satisfiable by illuminate/view[v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.33, v5.0.4, v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41, v5.1.6, v5.1.8, v5.2.0, v5.2.19, v5.2.21, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.31, v5.2.32, v5.2.37, v5.2.43, v5.2.45, v5.2.6, v5.2.7, v5.3.0, v5.3.16, v5.3.23, v5.3.4, v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9].
...

Issues with compiling layouts or page

I have tested this package for compile my layout file which include too much things.

However the result was not as expected.

But commenting method implodeLayout() worked fine, this:

    private function compile($viewPath)
    {
        $blade = file_get_contents($viewPath);
        //$this->implodeLayout($blade);//A1 @inprogress
        $this->implodeIncludes($blade);//A2 @pending

        return $blade;
    }

Without this the main yield('content') is replaced by:

{{--yield didnt have alternative--}}

Is not designed for works also with layouts?

If I try to compile a view that extends a layout, also not works, this is the result (most part are removed):

{{-- Extend layout was here --}}

@section('content')
    <div>
This is content
    </div>
@endsection
 <!DOCTYPE html>
<html>
<head>
    <?php extract([]); ?>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{csrf_token()}}">
<title>{{config('app.name')}}@yield('head-title')</title>
@stack('styles')
</head>
<body>
    <main class="app">
       {{--yield didnt have alternative--}}  // ... HERE SHOULD BE yield content
    </main>
@section('scripts')
    <?php extract([]); ?>
@stack('scripts')
<?php extract([]); ?>

// ... removed to shorten issue

@show
</body>
</html>

As you can see yield('content') is removed and the view compiled is on top and not inside content.

Maybe this works only with partials views?

Then I wonder why is added this php code for each included file:

<?php extract([]); ?>

Thanks

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.