I encountered the following error when I tried to generate a new bundle with Symfony:
Unknown "raw" tag
Symfony details:
"require": {
"php": ">=5.3.9",
"doctrine/doctrine-bundle": "~1.4",
"doctrine/orm": "^2.4.8",
"gregwar/image-bundle": "^2.1",
"incenteev/composer-parameter-handler": "~2.0",
"sensio/distribution-bundle": "~4.0",
"sensio/framework-extra-bundle": "^3.0.2",
"symfony/assetic-bundle": "~2.3",
"symfony/monolog-bundle": "^3.0.2",
"symfony/swiftmailer-bundle": "~2.3,>=2.3.10",
"symfony/symfony": "2.7.*",
"twig/twig": "^1.0||^2.0",
"whiteoctober/breadcrumbs-bundle": "*",
"friendsofsymfony/user-bundle": "~2.0.1"
},
"require-dev": {
"sensio/generator-bundle": "~2.3",
"symfony/phpunit-bridge": "~2.7"
}
In the new version of Twig tag raw had been removed. You should use verbatim tag instead. Proof - https://github.com/twigphp/Twig/blob/1.x/lib/Twig/Lexer.php#L302.
So, just search for {% raw %} tag in your twig files and replace it with {% verbatim %}.
Then search for {% endraw %} and replace it with {% endverbatim %}.
If you use the sensio/generator-bundle: Just remove it from composer.json and run composer require sensio/generator-bundle to get the correct version.
Why? This bundle uses the {% raw %} tag.
Related
Related:
Tailwind css backgroundImage doesn't work for me
tailwind.config.js:
module.exports = {
theme: {
...
extend: {
...
backgroundImage: {
"footer-sierpinski": "url('/bg.svg')",
},
Layout.astro:
...
<main class="flex-1 px-4">
<slot />
</main>
<!-- <img src="/bg.svg" /> --> <---- works
<!-- <div style="background-image: url('/apple-touch-icon.png');"></div> --> <--- doesn't work
<div class="text-slate-600 bg-footer-sierpinski"> <--- doesn't work
</div>
...
The image does not show regardless of format.
Tried different variations in the config file of tailwind:
/bg.svg
./bg.svg
../../public/bg.svg
/public/bg.svg
dependencies:
"devDependencies": {
"#astrojs/tailwind": "^1.0.0",
"astro": "1.1.1",
"autoprefixer": "^10.3.7",
"feed": "^4.2.2",
"prettier-plugin-astro": "^0.5.3",
"tailwindcss": "^3.1.8"
},
"dependencies": {
"#tailwindcss/aspect-ratio": "^0.4.0",
"#tailwindcss/typography": "^0.5.8",
"moment": "^2.29.4",
"rehype-autolink-headings": "^6.1.1",
"rehype-slug": "^5.0.1",
"twitter-api-client": "^1.6.1"
}
If you need to use a one-off background-image value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value.
<div class="bg-[url('/img/hero-pattern.svg')]">
So I stumbled upon headless ui since tailwind ui uses this for their functionality but my code isn't working..I have successfully installed vue 3 which is a requirement for headlessui/vue but I can't get it to work on my end. This is the code I'm talking about
<template>
<div class="w-full max-w-md px-2 py-16 sm:px-0">
<TabGroup>
<TabList class="flex p-1 space-x-1 bg-blue-900/20 rounded-xl">
<Tab
v-for="category in Object.keys(categories)"
as="template"
:key="category"
v-slot="{ selected }"
>
<button
:class="[
'w-full py-2.5 text-sm leading-5 font-medium text-blue-700 rounded-lg',
'focus:outline-none focus:ring-2 ring-offset-2 ring-offset-blue-400 ring-white ring-opacity-60',
selected
? 'bg-white shadow'
: 'text-blue-100 hover:bg-white/[0.12] hover:text-white',
]"
>
{{ category }}
</button>
</Tab>
</TabList>
<TabPanels class="mt-2">
<TabPanel
v-for="(posts, idx) in Object.values(categories)"
:key="idx"
:class="[
'bg-white rounded-xl p-3',
'focus:outline-none focus:ring-2 ring-offset-2 ring-offset-blue-400 ring-white ring-opacity-60',
]"
>
<ul>
<li
v-for="post in posts"
key="post.id"
class="relative p-3 rounded-md hover:bg-coolGray-100"
>
<h3 class="text-sm font-medium leading-5">
{{ post.title }}
</h3>
<ul
class="flex mt-1 space-x-1 text-xs font-normal leading-4 text-coolGray-500"
>
<li>{{ post.date }}</li>
<li>·</li>
<li>{{ post.commentCount }} comments</li>
<li>·</li>
<li>{{ post.shareCount }} shares</li>
</ul>
<a
href="#"
:class="[
'absolute inset-0 rounded-md',
'focus:z-10 focus:outline-none focus:ring-2 ring-blue-400',
]"
/>
</li>
</ul>
</TabPanel>
</TabPanels>
</TabGroup>
</div>
</template>
<script>
import { ref } from 'vue'
import { TabGroup, TabList, Tab, TabPanels, TabPanel } from '#headlessui/vue'
export default {
components: {
TabGroup,
TabList,
Tab,
TabPanels,
TabPanel,
},
setup() {
let categories = ref({
Recent: [
{
id: 1,
title: 'Does drinking coffee make you smarter?',
date: '5h ago',
commentCount: 5,
shareCount: 2,
},
{
id: 2,
title: "So you've bought coffee... now what?",
date: '2h ago',
commentCount: 3,
shareCount: 2,
},
],
Popular: [
{
id: 1,
title: 'Is tech making coffee better or worse?',
date: 'Jan 7',
commentCount: 29,
shareCount: 16,
},
{
id: 2,
title: 'The most innovative things happening in coffee',
date: 'Mar 19',
commentCount: 24,
shareCount: 12,
},
],
Trending: [
{
id: 1,
title: 'Ask Me Anything: 10 answers to your questions about coffee',
date: '2d ago',
commentCount: 9,
shareCount: 5,
},
{
id: 2,
title: "The worst advice we've ever heard about coffee",
date: '4d ago',
commentCount: 1,
shareCount: 2,
},
],
})
return { categories }
},
}
</script>
and here's my package.json with the dependencies
"devDependencies": {
"#tailwindcss/ui": "^0.3",
"#vue/compiler-sfc": "^3.2.4",
"autoprefixer": "^9.6",
"axios": "^0.21",
"bootstrap": "^4.6.0",
"jquery": "^3.6",
"laravel-mix": "^6.0.27",
"lodash": "^4.17.19",
"popper.js": "^1.16.1",
"postcss": "^8.1.14",
"postcss-import": "^12.0",
"postcss-nested": "^4.2",
"resolve-url-loader": "^3.1.2",
"sass": "^1.32.11",
"sass-loader": "^11.0.1",
"tailwindcss": "^1.8",
"vue": "^2.6.12",
"vue-loader": "^16.5.0",
"vue-template-compiler": "^2.6.12"
},
"dependencies": {
"#headlessui/vue": "^1.4.0",
"#heroicons/vue": "^1.0.4",
"#popperjs/core": "^2.9.3",
"#tailwindcss/forms": "^0.3.3",
"vue": "^3.2.4"
}
then my app.js where I handle my vue components
require('./bootstrap');
import { createApp } from 'vue'
import example from './components/ExampleComponent.vue'
import test from './components/test.vue'
createApp({
components:{
example,
test,
}
}).mount('#app')
I really hope anyone can help me if I understand how this structure works it would be a great help moving forward on my career
So I reviewed my code and the problem is that I put 2 script tags in the header and footer so I just removed the footer script and it works perfectly
I have a simple GridLayout
<GridLayout columns="*, *, *" rows="100">
<Label id="all-sales" text="0,0" row="0" col="0" style="background-color: blue"/>
<Label text="a,1" row="0" col="1" class="links" backgroundColor="blue" />
<Label text="0,1" row="0" col="3" class="links"/>
</GridLayout>
Note I have three labels that I am trying to style. The first uses an inline style, the second the what the NativeScript Docs call javascript property, and the last one with a class.
https://docs.nativescript.org/ui/styling
The only one that works is the javascript property.
This is an image of the iOS simulator.
I assuming I missing something because styling is in every example I've seen but it doesn't seem to work?
This is what I am running...
"dependencies": {
"#nativescript/theme": "^2.2.1",
"axios": "^0.19.2",
"nativescript-ui-listview": "^8.0.1",
"nativescript-ui-sidedrawer": "~8.0.0",
"nativescript-unit-test-runner": "^0.7.0",
"nativescript-vue": "~2.4.0",
"rxjs": "^6.4.0",
"tns-core-modules": "~6.3.0",
"typescript": "^3.7.5",
"vuex": "^3.1.2"
},
I have a twig template where I am displaying certain details based on the type of person.
But the condition is not working, I'm just wondering what is wrong with the IF clause?
{% if field_person_type == 'XXXXXXX' %}{{ (content.field_position) }}, {{ (content.field_unit) }}
{% else %} {{ (content.field_position) }}, {{ (content.field_institution) }} {% endif %}
And the content is defined below
Position field_position Text Text field
Person Type field_person_type Term reference Check boxes/radio buttons
Unit field_unit Text Text field
Institution field_institution Term reference Check boxes/radio buttons
When I use dump(field_person_type), it shows following
ARRAY(1) {
[0]=> ARRAY(2) {
["TID"]=> STRING(2) "40"
["TAXONOMY_TERM"]=> OBJECT(STDCLASS)#179 (8) {
["TID"]=> STRING(2) "40"
["VID"]=> STRING(1) "5"
["NAME"]=> STRING(7) "XXXXXXX"
["DESCRIPTION"]=> STRING(0) ""
["FORMAT"]=> STRING(2) "21"
["WEIGHT"]=> STRING(1) "2"
["VOCABULARY_MACHINE_NAME"]=> STRING(11) "PERSON_TYPE"
["PATH"]=> ARRAY(1) {
["PATHAUTO"]=> STRING(1) "1"
}
}
}
}
Try this field_person_type.0.taxonomy_term.name
Twig cannot access the name magically, you have to access it like you would access an array.
As the dump states: Your field (field_person_type) is an array. Inside you have [0] which is also an array with 2 entries. The "TAXONOMY_TERM" inside is an object so should be accessed as an object.
The following should give you your result
field_person_type[0]["TAXONOMY_TERM"].NAME
I've just updated my Symfony application to version 3.2 from 2.8.16 and now the web profiler toolbar not showing up as expected.
config_dev.yml
imports:
- { resource: config.yml }
framework:
router:
resource: "%kernel.root_dir%/config/routing_dev.yml"
strict_requirements: true
profiler: { only_exceptions: false }
web_profiler:
toolbar: true
intercept_redirects: false
position: top
Going to an automated error page (page not found error - 404) I can see the web debug toolbar completely empty:
The relative HTML code is the following:
<div id="sfwdt9c958d" class="sf-toolbar sf-display-none" data-sfurl="/app_dev.php/_wdt/9c958d" style="display: block;"><!-- START of Symfony Web Debug Toolbar -->
<div id="sfMiniToolbar-9c958d" class="sf-minitoolbar" data-no-turbolink="" style="display: none;">
<a href="#" title="Show Symfony toolbar" tabindex="-1" id="sfToolbarMiniToggler-9c958d" accesskey="D">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="24" height="24" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
<path fill="#AAAAAA" d=""></path>
</svg>
</a>
</div>
<style nonce="75799098050c6a6271f998e32cbdc849">
/* Omitted */
</style>
<div id="sfToolbarClearer-9c958d" class="sf-toolbar-clearer" style="display: block;"></div>
<div id="sfToolbarMainContent-9c958d" class="sf-toolbarreset clear-fix" data-no-turbolink="" style="display: block;">
<a class="hide-button" id="sfToolbarHideButton-9c958d" title="Close Toolbar" tabindex="-1" accesskey="D">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="24" height="24" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
</svg>
</a>
</div>
<!-- END of Symfony Web Debug Toolbar -->
</div>
I've never seen this bug before. Maybe it is connected with a non-core package/bundle?
composer.json
"require": {
"php": ">=7.0.0",
"symfony/symfony": "3.2.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"twig/twig": "1.28",
"twig/extensions": "^1.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"twbs/bootstrap": "~3.3",
"jms/translation-bundle": "dev-master",
"sensio/generator-bundle": "~3.0",
"egeloen/ckeditor-bundle": "^4.0",
"helios-ag/fm-elfinder-bundle": "~6",
"helios-ag/fm-elfinder-php-connector": ">=2.5",
"components/elfinder": ">=2.0",
"leaseweb/doctrine-pdo-dblib": "^1.0",
"symfony/finder": "^2.8",
"knplabs/knp-menu": "^2.1",
"knplabs/knp-menu-bundle": "^2.0",
"knplabs/knp-snappy-bundle": "dev-master",
"endroid/qrcode-bundle": "^1.6",
"endroid/qrcode": "^1.6",
"liuggio/excelbundle": "^2.0",
"stof/doctrine-extensions-bundle": "^1.2"
},
"require-dev": {
"sensio/generator-bundle": "~3.0",
"symfony/phpunit-bridge": "^3.2"
},
Starting from this well written upgrading guide I've reviewed all the configuration steps.
Then I've analyzed the default composer.json of Symfony v3.2.2 and in particular the required twig version. I tried changing my Twig requirements with:
"twig/twig": "~1.28|~2.0",
but sadly I'm using JMS translation bundle, which is not compatible with the latest Twig v2.1+ as reported in this PR.
I found the solution removing the 2.0 requirement. So, to fix the issue I changed the Twig version requirement with "twig/twig": "~1.28" and the profiler bundle now seems to work as before.