Показаны сообщения с ярлыком encore. Показать все сообщения
Показаны сообщения с ярлыком encore. Показать все сообщения

воскресенье, 27 июня 2021 г.

how to load BazingaJsTranslationBundle without ajax requests (+ inside Vue components)

  1. Install it as in bundle readme.md
  2. run `php bin/console bazinga:js-translation:dump public/js --format=js`
  3. add in your main template tag: <html lang="{{ app.request.locale|split('_')[0] }}">
  4. add in your js file:
    global.Translator = require('../public/bundles/bazingajstranslation/js/translator.min');
    require('../public/js/translations/messages/ru.js');
  5. if you need also access Translator via Vue, add it in your Vue initialization file:
    Vue.prototype.$t = Translator;
    And use it in your template like this: 
    {{ $t.trans('common.save') }}

вторник, 25 августа 2020 г.

Encore does not load css/sass files in tsx/js files fixed

 If you installed @types/node-sass, enabled enableSassLoader in webpack.config.js, ran yarn add sass-loader@^8.0.0 node-sass --dev , do not forget to add {{ encore_entry_link_tags('main') }} like this (for example in templates/base.html.twig:


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>{% block title %}Welcome!{% endblock %}</title>
{% block stylesheets %}
{{ encore_entry_link_tags('main') }}
{% endblock %}
</head>
<body>
{% block body %}{% endblock %}
{% block javascripts %}
{{ encore_entry_script_tags('main') }}
{% endblock %}
</body>
</html>

понедельник, 28 января 2019 г.

[Webpack] Module not found: Error: Empty dependency (no request) fix

If you have these errors in Webpack (encore):
This dependency was not found:

*  in ./node_modules/css-loader??ref--1-2!./src/AppBundle/Resources/public/css/styles.css


or:

Module build failed: ModuleNotFoundError: Module not found: Error: Empty dependency (no request)
   at factoryCallback (/var/www/project/core/node_modules/webpack/lib/Compilation.js:282:40)


It because you have background-image("") without an url. Add it or remove this attribute.