Skip to content

Commit

Permalink
Merge branch 'release/3.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
swthate committed Jun 10, 2019
2 parents cf564e1 + deeb5b4 commit 6f7af1c
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 32 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 3.0.2 - 2019-06-10
### Added
- Moved most of `index.twig` to `layouts/_base.twig` and now `index.twig` extends that base layout.
### Fixed
- Was using the wrong method to get the site's CSRF Token and add it to the window for JS to use. Changed `craft.app.config.general.csrfToken` to `craft.app.request.csrfToken`.

## 3.0.1 - 2019-06-10
### Fixed
- `composer.json` had an autoload.psr-4 invalid value: `"modules\\sitemodule"` needs to end with a namespace separator, i.e. `"modules\\sitemodule\\"`.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "craft-workbench",
"version": "3.0.1",
"version": "3.0.2",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down
38 changes: 7 additions & 31 deletions templates/index.twig
Original file line number Diff line number Diff line change
@@ -1,40 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>{{ siteName }}</title>
{% extends 'layouts/_base.twig' %}

{{ craft.twigpack.includeCssModule("app.css", true) }}

{% set jsCraft = {
baseUrl: alias('@web'),
csrfTokenName: craft.app.config.general.csrfTokenName,
csrfToken: craft.app.config.general.csrfToken
} %}
<script type="text/javascript">
window.Craft = {{ jsCraft|json_encode|raw }}
console.log(window.Craft);
</script>
</head>

<body class="bg-gray-700">
<div id="app">

{% block content %}

{% set info = {
craftVersion: craft.app.getVersion(),
environment: getenv('ENVIRONMENT')
} %}

<hello-world :info="{{ info|json_encode }}">
{{ getenv('DB_DATABASE') }}
</hello-world>
</div>

{{ craft.twigpack.includeSafariNomoduleFix() }}
{{ craft.twigpack.includeJsModule("app.js", true) }}
{{ craft.twigpack.includeJsModule("chunk-vendors.js", true) }}
<hello-world :info="{{ info|json_encode }}">
{{ getenv('DB_DATABASE') }}
</hello-world>

</body>
</html>
{% endblock %}
33 changes: 33 additions & 0 deletions templates/layouts/_base.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>{{ siteName }}</title>

{{ craft.twigpack.includeCssModule("app.css", true) }}

{% set jsCraft = {
baseUrl: alias('@web'),
csrfTokenName: craft.app.config.general.csrfTokenName,
csrfToken: craft.app.request.csrfToken
} %}
<script type="text/javascript">
window.Craft = {{ jsCraft|json_encode|raw }}
</script>
</head>

<body class="bg-gray-700">
<div id="app">

{% block content %}{% endblock %}

</div>

{{ craft.twigpack.includeSafariNomoduleFix() }}
{{ craft.twigpack.includeJsModule("app.js", true) }}
{{ craft.twigpack.includeJsModule("chunk-vendors.js", true) }}

</body>
</html>

0 comments on commit 6f7af1c

Please sign in to comment.