werkint/frontend-mapper-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

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

v0.0.1 2016-01-06 12:45 UTC

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

  1. do lines above (create gulpfile.js, npm install ...)

  2. 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": "*"
      }
    }
  3. 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)
    }());
  4. 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>
  5. run app/console as:in and gulp

  6. test

requirejs(['jquery'], function ($) { alert($); })