Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(vue-renderer): support evaluation in templates #6505

Merged
merged 4 commits into from Nov 24, 2019
Merged

feat(vue-renderer): support evaluation in templates #6505

merged 4 commits into from Nov 24, 2019

Conversation

farnabaz
Copy link
Member

@farnabaz farnabaz commented Oct 2, 2019

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

In Nuxt we can't use conditions in the app template.
Nuxt loads app.html with Webpack HTMLPLugin and this plugin internally evaluate templates, Because of this, Nuxt can't evaluate templates like <% if (something) { %> ... <% } %> on run time, and this code evaluates at build.

This change gave more flexibility to app templates, and define a new block for run-time evaluation. for a simple usage

<html>
    <head>
        {{ HEAD }}
        {% if (ENV.NODE_ENV === 'dev') { %}
            <!-- debug scripts -->
        {% } else if (ENV.NODE_ENV === 'production') { %}
            <!-- production scripts -->
        {% } %}
    </head>
    <body>
        {{ APP }}
    </body>
</html>

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly. (PR: #)
  • I have added tests to cover my changes (if not applicable, please state why)
  • All new and existing tests are passing.

@codecov-io
Copy link

codecov-io commented Oct 2, 2019

Codecov Report

Merging #6505 into dev will decrease coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #6505      +/-   ##
==========================================
- Coverage   95.83%   95.79%   -0.04%     
==========================================
  Files          78       78              
  Lines        2713     2713              
  Branches      702      702              
==========================================
- Hits         2600     2599       -1     
- Misses         98       99       +1     
  Partials       15       15
Flag Coverage Δ
#e2e 100% <ø> (ø) ⬆️
#fixtures 64.65% <ø> (ø) ⬆️
#unit 92.29% <ø> (-0.04%) ⬇️
Impacted Files Coverage Δ
packages/vue-renderer/src/renderer.js 93.49% <ø> (-0.82%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5a46547...c24a126. Read the comment docs.

@manniL
Copy link
Member

manniL commented Oct 8, 2019

Could you add a test for the feature? ☺️

@farnabaz
Copy link
Member Author

@manniL I've modified custom-app-template test to check template evaluation too.

I don't know why e2e test failed after this commit

@galvez galvez requested a review from a team November 24, 2019 06:50
@galvez galvez changed the title feat(template-evaluate): support evaluation in templates feat(vueapp): support evaluation in templates Nov 24, 2019
@galvez galvez changed the title feat(vueapp): support evaluation in templates feat(vue-renderer): support evaluation in templates Nov 24, 2019
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants