werkint / frontend-mapper-bundle
This bundle provides integration of gulp into Symfony2
Installs: 1 114
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 5
Forks: 0
Open Issues: 0
Language:JavaScript
Type:symfony-bundle
Requires
- php: >=5.5
- kriswallsmith/assetic: >=1.0
- symfony/finder: >=2.0
- symfony/framework-bundle: >=2.0.9
- symfony/yaml: >=2.0
Requires (Dev)
- phpunit/phpunit: 3.7.*
- squizlabs/php_codesniffer: 1.*
- twig/extensions: v1.0.0
This package is not auto-updated.
Last update: 2022-02-01 12:48:24 UTC
README
requirejs.config({
"config": {
"translatorLoader": {
"domains": [{
name: 'messages',
locales: ['en', document.documentElement.lang],
}]
}
},
});
copy file to project: package.json
cd path/to/project
cp vendor/werkint/frontend-mapper-bundle/package.json ./
and run npm install
may help:
also npm install --save glob
vendor/werkint/frontend-mapper-bundle/src/DependencyInjection/Compiler/JsmodelProviderPass.php
gulpfile.js
(function () { 'use strict'; process.env.NODE_MAX_LISTENER = 500; require('./vendor/werkint/frontend-mapper-bundle/src/Resources/gulp/index.js')(); })();
bower.json
touch app/config/bower.json
{ "name": "brander-app", "version": "0.0.1", "authors": [ "Someone <someone@gmail.com>" ], "ignore": [ "**/.*" ], "resolutions": { "underscore": "~1.8.3", "backbone": "~1.1.2", "backbone.relational": "2f66cc5022" }, "overrides": { "renames": {}, "social": { "normalize": { "js/social": "*.js" } }, "requirejs-domready": { "main": [ "domReady.js" ] }, "tabslet": { "main": [ "jquery.tabslet.js" ] } } }
Usual configuration
-
do lines above (create gulpfile.js, npm install ...)
-
create bundle dependencies src/AppBundle/bower.json
{ "name": "sdelka-app", "main": [ "bower.json" ], "dependencies": { "requirejs": "*", "jquery": "*", "lodash": "*", "backbone": "*", "backbone.relational": "*", "backbone.marionette": "*", "backbone.modelbinder": "*", "twig.js": "*", "backbone.radio": "*", "backbone.paginator": "*" } }
-
create config src/AppBundle/Resources/public/config.js
(function () { 'use strict'; var config = window.require ? window.require : {}; config = { 'paths': config.paths, 'waitSeconds': 30, 'urlArgs': 'bust=' + window.$assets_version, "baseUrl": "/assets/js", "map": { /* "*": { "twig": "config/twig", }, "config/twig": { "twig": "twig", }, "config/iwin-twitter": { "social/module.twitter": "social/module.twitter", },*/ }, "shim": { "jquery.elastic": { deps: ["jquery"] }, }, "config": { /*"social/api.google-loader": window.$socials.google,*/ }, }; require.config(config) }());
-
edit app/Resources/views/base.html.twig
<head> <meta charset="UTF-8" /> <title>{% block title %}Welcome!{% endblock %}</title> {% block stylesheets %}{% endblock %} <link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" /> <!-- require --> <script src="{{ asset('assets/js/require.js') }}"></script> <!-- require config --> <script src="{{ asset('bundles/app/config.js') }}"></script> </head>
-
run
app/console as:in
andgulp
-
test
requirejs(['jquery'], function ($) { alert($); })