Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Config To Js Bundle Laravel Package

dawen/config-to-js-bundle

View on GitHub
Deep Wiki
Context7

config-to-js-bundle

Build Status

Provides a command to dump defined config to js file.


Installation

Step 1: Composer

Required in composer.json

   "dawen/config-to-js-bundle": "~1.0"

Run composer update dawen/config-to-js-bundle after modifiering composer.json file.

Step 2: AppKernel

In your app/config/AppKernel.php file you should activate the bundle by adding it to the array

    $bundles[] = new Dawen\Bundle\ConfigToJsBundle\ConfigToJsBundle();

Step 3: Configuration

    config_to_js:
      type: 'module'
      output_path: '%kernel.root_dir%/../web/js/app-config.js'
      config:
        imageLocation: 'http://this-is-an-example.com/images'
        appVersion: '1.1.0'

If parameter are not defined, default values will be applied.

Step 4: Run the command

Go to your console and run

    bin/console config:js:dump

Configuration Parameter Description

type:

possible values: module default value: module description: This defines for what the dumped code is optimized.

output_path:

possible values: a valid string for a filepath default value: null description: This parameter defines a path and filename that will be created. If this value is not set, the dumper will throw an error.

config:

possible values: array default value: empty array description: Here you can create you config vars that should be availabe on your javascript side.


Supported Types/Renderers

module: Your file is includeable by module pattern like this: import appConfig from './ccurrent-folder/web/js/app-config.js'

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity