Code Monkey home page Code Monkey logo

hearsayrequirejsbundle's People

Contributors

apsavin avatar arnaud-lb avatar athieriot avatar craigmarvelley avatar guilhermeblanco avatar igorw avatar jeffreymb avatar kmontag avatar matoilic avatar piotrplenik avatar seggen-ibuildings avatar seldaek avatar sfblaauw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hearsayrequirejsbundle's Issues

Incorrect <script> output in production

In production I'm seeing html generated that looks like

 <script type="text/javascript" src="platform/main"></script>

Which obviously won't load any js. I've tried cache:clear, assets:install, assetic:dump to no avail.

Any pointers as to what I might be doing wrong? Here are my settings:

config.yml

hearsay_require_js:
    require_js_src:      //cdnjs.cloudflare.com/ajax/libs/require.js/2.1.8/require.min.js
    initialize_template: HearsayRequireJSBundle::initialize.html.twig
    base_url:            "js/app"
    base_dir:            %node_prefix%/lib/node_modules/requirejs/bin/
    paths:
        backbone:
            location: "@MyAppCoreBundle/Resources/public/components/backbone/backbone"
        backgrid:
            location: "@MyAppCoreBundle/Resources/public/components/backgrid/lib/backgrid"
        bootstrap:
            location: "@MyAppCoreBundle/Resources/public/components/bootstrap/dist/js/bootstrap"
        bridge:
            location: "@MyAppBridgeBundle/Resources/public/js/src/bridge"
        editor:
            location: "@MyAppEditorBundle/Resources/public/js"
        jquery:
            location: "@MyAppCoreBundle/Resources/public/components/jquery/dist/jquery.min"
        jquery.unveil:
            location: "@MyAppCoreBundle/Resources/public/components/unveil/jquery.unveil"
        modernizr:
            location: "@MyAppCoreBundle/Resources/public/components/modernizr/modernizr"
        platform:
            location: "@MyAppPlatformBundle/Resources/public/js"
        underscore:
            location: "@MyAppCoreBundle/Resources/public/components/underscore/underscore"
    shim:
        backbone:
            deps:    [ jquery, underscore ]
            exports: Backbone
        backgrid:
            deps:    [ backbone ]
            exports: Backgrid
        bootstrap:
            deps:    [ jquery ]
        jquery.unveil:
            deps:    [ jquery ]
        modernizr:
            exports: Modernizr
        underscore:
            exports: _
    options:
    optimizer:
        path:                    %node_prefix%/lib/node_modules/requirejs/bin/r.js
        hide_unoptimized_assets: false
        almond_path:             %node_prefix%/lib/node_modules/almond/almond.js
        exclude:                 []
        options:
        timeout: 60

layout.html.twig

<body class="{% if app.user %} authenticated{% endif %} {{ body_class|default('') }}">

  {# Output body #}
  {% block body %}{% endblock %}

  {# Platform RequireJS #}
  {% javascripts output='js/app/editor.js' filter='requirejs'
    '@MyAppPlatformBundle/Resources/public/js/main.js'  %}
    {{ require_js_initialize({ 'main' : 'platform/main' }) }}
  {% endjavascripts %}
</body>

development output

<script type="text/javascript">var require={"baseUrl":"\/js\/app","locale":"en","paths":{"backbone":"\/js\/app\/backbone\/backbone","backgrid":"\/js\/app\/backgrid\/backgrid","bootstrap":"\/js\/app\/bootstrap\/bootstrap","bridge":"\/js\/app\/bridge","editor":"\/js\/app\/editor","jquery":"\/js\/app\/jquery\/jquery.min","jquery.unveil":"\/js\/app\/jquery.unveil\/jquery.unveil","modernizr":"\/js\/app\/modernizr\/modernizr","platform":"\/js\/app\/platform","underscore":"\/js\/app\/underscore\/underscore","":"\/js\/app\/"},"shim":{"backbone":{"deps":["jquery","underscore"],"exports":"Backbone"},"backgrid":{"deps":["backbone"],"exports":"Backgrid"},"bootstrap":{"deps":["jquery"]},"jquery.unveil":{"deps":["jquery"]},"modernizr":{"exports":"Modernizr","deps":[]},"underscore":{"exports":"_","deps":[]}}};</script><script type="text/javascript" data-main="platform/main" src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.8/require.min.js"></script>

Create a recent tag

Could you create a recent tag which we can use so we can ensure we're on a stable version of the code?

The last tag was created 9 months ago.

Assetic filter with production flag causes 404 errors in dev environment

Using the 1.0 branch (because it supports build_profie, see #43) with use_controller: true for assetic in dev environment to dynamically generate assets on page load and using the assetic filter with the production flag (see example below) I end up with 404s in dev environment. It seems the asset url should still be generated but the filter should just not be applied. Instead it seems that the asset is not generated at all but the url is returned as /js/foo.js which is not served by assetic and is a 404.

{% javascripts
    filter='?requirejs'
    '@AcmeDemoBundle/Resources/public/js/src/main.js'
%}

Coffeescript support

I'm not sure what I read. Is it possible to use coffee script code,convert it in javascript and optimize it in a single AMD js file ?
If yes, what is the typical configuration?

Almond integration

Hi, like @jrburke says:

Some developers like to use the AMD API to code modular JavaScript, but after doing an optimized build, they do not want to include a full AMD loader like RequireJS, since they do not need all that functionality...

This is the reason why I believe that it will be nice to have the possibility to use Almond for production environment.

I sent a PR with an approach and you can download and test it in HearsayRequireJSWithAlmond.

There is no test but If you think that can be integrated in HearsayRequireJSBundle I can do it.

Sorry for my english. Thanks.

Service ("templating.helper.assets") on cache:clear

Clearing the cache for the dev environment with debug true

[Symfony\Component\DependencyInjection\Exception\InactiveScopeException]
You cannot create a service ("templating.helper.assets") of an inactive scope ("request").

Exception trace:
() at /Users/enkas/Sites/SFC/symfony2/app/cache/de_/ap_DevDebugProjectContainer.php:4887
ap_DevDebugProjectContainer->getTemplating_Helper_AssetsService() at /Users/enkas/Sites/SFC/symfony2/app/bootstrap.php.cache:129
Symfony\Component\DependencyInjection\Container->get() at /Users/enkas/Sites/SFC/symfony2/vendor/hearsay/require-js-bundle/Hearsay/RequireJSBundle/Configuration/ConfigurationBuilder.php:184

Fix src() method in RequireJSHelper.php

Hi there,

I'm using PHP templates instead of Twig templates, and when initializing RequireJS using

/* @var Hearsay\RequireJSBundle\Templating\Helper\RequireJSHelper $requireJs */
$requireJs = $view['require_js'];
echo $requireJs->initialize();

I get the following error:

An exception has been thrown during the rendering of a template ("Template name "/media/Storage/backed-up-storage/work/picofnet/website/website/app/../src/Picof/BaseBundle/Resources/public/components/requirejs/requirejs" contains invalid characters.") in HearsayRequireJSBundle::initialize.html.twig at line 46.

Doesn't matter whether I use the default file

hearsay_require_js:
    require_js_src:      //cdnjs.cloudflare.com/ajax/libs/require.js/2.1.8/require.min.js

or a custom file

hearsay_require_js:
    require_js_src:      %kernel.root_dir%/../src/Picof/BaseBundle/Resources/public/components/requirejs/requirejs

The fix is easy. The RequireJSHelper::src() method should first check if the file is supported by the rendering engine, and only then check if it exists. Not the other way around like it is doing now.

I'm going to do a pull request, if that's alright.

Thanks!

assetic:dump --watch keeps generating files

Hi,

I am using the latest master build of RequireJSBundle and when using i noticed existing files are not removed and new files keep generating untill the "unable to write" exception is thrown.

php app/console assetic:dump --watch

File example:

10:05:28 [file+]     /web/symfony.coremanager.dev/app/../web/js/general_part_1_general_part_1_1_general_part_1_general_part_1_1_1_general_part_1_general_part_1_1_general_part_1_general_part_1_1_1_1_general_part_1_general_part_1_1_general_part_1_general_part_1_1_1_general_part_1_general_part_1_1_general_part_1_general_part_1_1_1_1_1.js
[error] Unable to write file /web/symfony.coremanager.dev/app/../web/js/general_part_1_general_part_1_1_general_part_1_general_part_1_1_1_general_part_1_general_part_1_1_general_part_1_general_part_1_1_1_1_general_part_1_general_part_1_1_general_part_1_general_part_1_1_1_general_part_1_general_part_1_1_general_part_1_general_part_1_1_1_1_1.js

Im guessing something is wrong in the Assetic loader?

my config:

# RequireJS configuration
hearsay_require_js:
    base_url:            "js"
    base_dir:            "%kernel.root_dir%/../web/js"
    paths:
        jquery:            "%kernel.root_dir%/Resources/public/js/jquery"
        datatable_plugin:  "@MyBundle/Resources/public/js/datatables/plugins"
        datatable:         "%kernel.root_dir%/Resources/components/datatables/media/js/jquery.dataTables"
    shim:
        datatable:
            deps: ['jquery']

RequireJSOptimizerFilter and r.js version 2.1.5

Hi,

I'm fighting a little to get this bundle working when using "php app/console assetic:dump --env=prod --no-debug" and the latest version of r.js ( 2.1.5 )

When specifying the following config in config.yml everything works fine on app_dev.php/:

hearsay_require_js:
optimizer:
path: /opt/local/lib/node_modules/requirejs/bin/r.js
options: { skipModuleInsertion: true }
base_directory: %kernel.root_dir%/Resources/js
paths:
jquery: %kernel.root_dir%/../vendor/jquery/jquery/jquery-1.9.1.js

But when dumping the assets i get the following error:
Error: ENOENT, no such file or directory '/Users/jeroen/Projects/sandwidgetspread/app/../vendor/jquery/jquery/jquery-1.9.1.js.js'

Please note the double .js.js extension!

r.js seems to want the path without the extension.

Am I doing something wrong or is this bundle not compatible with this version of r.js ?

Many thanks!

Twig Exception about Template name...

As previously indicated in my comments to commit 9293c46, I get the following exception when updating to that commit or beyond:

CRITICAL - Uncaught PHP Exception Twig_Error_Runtime: "An exception has been thrown during the rendering of a template ("Template name "/cdnjs.cloudflare.com/ajax/libs/require.js/2.1.8/require.min.js" is not valid (format is "bundle:section:template.format.engine").") in "HearsayRequireJSBundle::initialize.html.twig"

Apparently, this error has to do with the format of the default "require_js_src" parameter. Should I not use the default?

I have tried changing my configuration but the error persists. Here is my configuration (which should be pretty standard):

# app/config/config.yml
hearsay_require_js:
    base_dir: '%kernel.root_dir%/../src/Acme/DemoBundle/Resources/public/js'
    paths:
        jquery:
            location: [//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min, %kernel.root_dir%/../src/Acme/DemoBundle/Resources/public/js/libs/jquery/2.0.0/jquery.min]
            external: true
        underscore:
            location: [//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min, %kernel.root_dir%/../src/Acme/DemoBundle/Resources/public/js/libs/underscore/1.4.4/underscore-min]
            external: true
        backbone:
            location: [//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min, %kernel.root_dir%/../src/Acme/DemoBundle/Resources/public/js/libs/backbone/1.0.0/backbone-min]
            external: true
    shim:
        backbone:
            deps: [underscore, jquery]
            exports: Backbone
        underscore:
            exports: _
    optimizer:
        path: %kernel.root_dir%/../src/Acme/DemoBundle/Resources/public/js/libs/require/2.1.8/r.js
        hide_unoptimized_assets: false
        options:
            name: app

twig:
    debug:            %kernel.debug%
    strict_variables: %kernel.debug%

assetic:
    debug:          %kernel.debug%
    use_controller: false
    bundles:        [DemoBundle]
    #java: /usr/bin/java
    filters:
        compass: ~
        cssrewrite: ~

Also, I'm using RequireJS as an Assetic filter in my template as follows:

{% block scripts %}
    {% javascripts filter='?requirejs' '@AcmeDemoBundle/Resources/public/js/app.js' %}
        {{ require_js_initialize({ 'main': asset_url })}}
    {% endjavascripts %}
{% endblock %}

And my main "app.js" file that should be loaded:

// Filename src/Acme/DemoBundle/Resources/public/js/app.js

"use strict";

require([
  'router',
  'modules/main',
], function(Router, Main) {
  new Router;
  new Main;
});

Define path fallback in the configuration file?

I'm using the latest version of this bundle with Symfony 2.2 and would like to use external scripts loaded from a CDN for the require.min.js, jquery and other files. I tried the following in my Symfony2 config.yml file:

hearsay_require_js:
    base_directory: %kernel.root_dir%/../src/MyVendor/MyBundle/Resources/public/js
    require_js_src: [//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.5/require.min.js, /js/libs/require/2.1.5/require.min.js]
    paths:
        jquery:
            location: [//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min, /js/libs/jquery/2.0.0/jquery.min]
            external: true

However, the following error was thrown when updating the autoload file with composer update: Invalid type for path "hearsay_require_js.require_js_src". Expected scalar, but got array. Is there a way to define local fallbacks when external CDN resources are used? Would the "external: true" definition still apply if the fallback is used?

Is there sample app shows how to use it?

Hello, I'm newbe to require.js and I'don't understund how to use it this bundle correctly... Is there sample app shows how to use it in the web? How to define require modules and where... ?

Setting hide_unoptimized_assets to false causes an InvalidConfigurationException

In my config.yml file I've set hide_unoptimized_assets to true, and I have a working environment where r.js builds a single js file of the application, when I dump the assets with the assetic:dump console command etc.

However, in my dev environment (where nothing is supposed to be built into a single file), requests for the js files fails with a 404, when hide_unoptimized_assets is set to true (No route found etc). So I tried to set hide_unoptimized_assets to false in my dev settings, but that fails with an InvalidConfigurationException ('The path "hearsay_require_js.optimizer.hide_unoptimized_assets" cannot contain an empty value, but got false'). Looking at the configuration of the bundle, hide_unoptimized_assets is not allowed to be empty (cannotBeEmpty()). Removing this from the configuration makes everything work perfect.

Is there a reason why this is not allowed to be set to false, or could this limitation (cannotBeEmpty()) be removed?

Multiple bundles?

Using the r.js optimiser, is it possible to define multiple entry points? If I'm using the Assetic filter, is it smart enough to ahead-of-time compile the required entrypoint? The reason why I ask, is that different pages load different JS entrypoints, which require() their dependencies, and it'd be awesome if the r.js optimiser when used with this bundle would handle that!

enable JS File loading from public folders to increase performance in development

We are having the Issue that we use a lot of modules ( 20+ per page ), and since all of them in dev mode are loaded via PHP, this slows development ( especially if you develop in Vagrant like we do ) down considerably, we ether run in timeouts or have to wait forever before all modules are loaded.

As a Solution i would like to be able to load the modules directly form their public folders bypassing PHP / Symfony2 like:

require([
    '/bundles/acmebundle/js/module1.js',
    '/bundles/acmebundle/js/module2.js'
],
    function (module1, module2) {
        'use strict';
        // code
    }
);

This works in dev but breaks on assetic dump.

2.0 does not support build_profile option in bundle configuration

The current 2.0 branch does not support the build_profile configuration option to allow for external build profile. I found this to be a key feature for any dynamic/runtime generated modules that I needed to mark as :empty so they would not create an error during build because they cannot be located. This is also a key feature for advanced configuration.

require_js Twig global no longer created

I'm getting the error message Variable "hearsay_require_js" does not exist when following the instructions:

If you need to do anything fancy with the configuration, you can do so manually by modifying the default configuration, and suppressing config output when initializing RequireJS

A trip into ./Twig/Extension/RequireJSExtension.php shows that the reason for that error is that unlike in the 1.0.0 branch the Twig global is now never actually created.

Adding:

    public function getGlobals()
    {
        return array(
            'require_js' => array(
                'config' => $this->getHelper()->config(),
                'src' => $this->getHelper()->src(),
            ),
        );
    }

to ./Twig/Extension/RequireJSExtension.php.

and:

    public function config()
    {

        return $this->configurationBuilder->getConfiguration();
    }

to ./Templating/Helper/RequireJSHelper.php

adds back in the functionality from the 1.0 branch.

More docs on how integrated with Assetic

The docs do not explain at all how the bundle works. It only describes how to configure it. Please give some information on how this hooks into assetic and what configuration for assetic has to be done to make it work.

RequireJS 2.0 support and other improvements

With the release of RequireJS 2.0, it has become even more simple to manage module dependencies. The current version of HearsayRequireJSBundle does not work with the most recent release of RequireJS because it needs some work to get this upgrade rolling (see upgrade notes). Above are some notes from a debugging session, although I'm not sure what's the best way to fix them. I'll be more than happy if we can brainstorm on possible solutions for these issues:

  • baseUrl does not work well with data-main, since this attribute not requires a module. When used in conjunction with use_controller at true and Assetic, it will report a 404 since the asset_url expects to have a .js extension but RequireJS automatically removes it now (see here). This means assetic won't be able to serve that file (e.g. GET http://project.dev/app_dev.php/js/92bcd61_documents_1)

An alternative would be generating a dynamic config file and calling require.config instead of using the data-main attribute. The disadvantage of this method is that we would need a custom route for this and a real file would have to be generated for production minification.

Example:

require.config({
  deps: [ {{ real_module_to_load }} ],

  paths: { ... }
  }
});

Assetic would have to know about this file and the deps it loads so that the r.js optimizer can kick in.

  • paths: one of the best features of paths configuration is the possibility of aliasing long lib path names. Although the docs say this is possible using the config.yml directive, it does not appear to work well with Assetic, due to incorrect URL resolution. alpha: '%kernel.root_dir%/../src/MyProject/DocumentBundle/Resources/public/js/vendor/alpha/alpha.js' does not appear to be resolved when require(['alpha'])is called.
  • require_js_src is prepared to load a CDN version of RequireJS only - not local versions.
  • shims: another great addition of RequireJS is the support to use shims, effectively wrapping non-AMD libs such as Backbone, Lodash, jQuery Plugins, etc. This is fundamental since we no longer need to use custom versions with our own define patches.

Undefined method

Call to undefined method Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition::normalizeKeys() in DependencyInjection\Configuration.php on line 54.

->normalizeKeys(false) was added to the configuration recently, however it causes the above exception to be thrown. (added here)

Which version of ArrayNodeDefinition supports normalizeKeys as I'm unable to find it?

Assetic filter not run on cache:clear

Since Assetic does a asset dump on cache:clear, I would expect RequireJSOptimizerFilter to run too, but it doesn't appear to.

Haven't done much digging, as to why yet.

Use this bundle with php templating engine (not twig)

This may be considered a feature request... unless it is already possible. In that case maybe a doc needs to be written because for the life of me I cannot figure out how to call require_js_initialize() in a php template. I would put this on stack overflow but you guys don't seem to have a tag.

baseUrl is not absolute

My template has the following

{% block javascripts %}
    {{ parent() }}
    <script type='text/javascript'>require(['wedcore/edit'], function() {})</script>
{% endblock %}

My Config looks like so


hearsay_require_js:
    base_directory: %kernel.root_dir%/scripts
    paths: 
        jquery:
            location: //ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min
            external: true
        wedcore: '@WedCoreBundle/Resources/scripts'
    optimizer:
        path: /path/to/r.js
        excludes: [ excluded/module ] # Modules to exclude from the build (optional)
        options: { skipModuleInsertion: true } # Additional options to pass to the optimizer (optional)

When I hit the following url: http://rangelwed/app_dev.php/reception/edit

My require block generates the following

<script type='text/javascript'>var require={"baseUrl":"js","locale":null,"paths":{"jquery":"\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.7.1\/jquery.min"}}</script><script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/require.js/1.0.1/require.min.js'></script>

<script type='text/javascript'>require(['wedcore/edit'], function() {})</script>

if you notice the baseUrl it's relative. This causes the request to wedcore/edit to go to http://rangelwed/app_dev.php/reception/js/wedcore/edit.js. This is incorrect and instead should go to http://rangelwed/app_dev.php/js/wedcore/edit.js.

So the base URL should be rendered as /app_dev.php/js/.

Thanks,
Raul

How can I use modules for r.js?

I have a multi-page project and want organize my scripts following this example. But when I specify "modules" section in the build profile for r.js, optimizer throws an error:

Optimization failed: Error: If the "modules" option is used, then there should be a "dir" option set and "out" should not be used since "out" is only for single file optimization output.
at Function.build.createConfig (/home/abalakirev/www40/my-ru/app/Resources/js-vendors/js/RequireJS/r.js:23253:19)

If I set the "dir" option, optimizer says "out" option is incompatible with "modules".

What I'm doing wrong? What the true way for organizing scripts in a multi-page application using your bundle?

External Path definition in config.yml file is not working?

With the latest 1.0.5 and 2.0.x-dev versions of this bundle, defining external locations in the Paths are not working.
If I use either:

paths:
    jquery:
        location: //ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min
        external: true

Or:

paths:
    jquery:
        location: [//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min, /js/libs/jquery/2.0.3/jquery.min]
        external: true

I get the following error while loading the page in the browser:

Error: Script error for: jquery http://requirejs.org/docs/errors.html#scripterror

However, if I use an internal location like the following, I get no script errors, and everything loads fine:

paths:
   jquery: %kernel.root_dir%/../src/MyVendor/SiteBundle/Resources/public/js/libs/jquery/2.0.3/jquery.min

It is to notice that the issue was introduced with a recent commit. Up until commit #45c852aeb444aedf8211838c3512acbb146b4d72, there was no problem with this.

Assets config not being included

Hi there.

Following config:

hearsay_require_js:
    base_directory: "%kernel.root_dir%/../src/Acme/DemoBundle/Resources/public/js"
    base_url:       "/bundles/acmedemobundle/js"
    require_js_src: "/bundles/acmedemobundle/js/vendors/require.js"
    paths:
        # these dont work
        frontend:       "%kernel.root_dir%/../src/Acme/DemoBundle/Resources/public/js"

I'm also serving assets statically (i.e. not through the assetic controller) and am don't have r.js configured (I assume this is optional).

The paths directive is not being passed through to the view.
Looking through HearsayRequireJSExtension.php's method addExternalNamespaceMapping line #136 adds paths for external pages:

$config->addMethodCall('setPath', array($path, $location));

However, the equivalent method for internal pages addNamespaceMapping doesn't contain any such call.

Is there any reason for this? Maybe I'm missing something?

extra template neccessary for require.js

Instead of using //cdnjs.*.require.min.js as require_js_src in the config, we used to point directly to the js file hosted on our server. Now we had to create a twig template which we have to load, which does nothing but point to the js asset.

To clarify:
Before in our config:
hearsay_require_js:
require_js_src: '/bundles/demofrontend/js/vendors/require.min.js'

hearsay_require_js:
require_js_src: 'DemoFrontendBundle::Page/Components/requirejs.html.twig'

in our requirejs.html.twig:
does nothing but load the js asset.

I would be glad to hear about a fix for this problem

Errors with Laravel 4. (phpunit tests)

Time: 11 seconds, Memory: 9.75Mb

There were 3 errors:

  1. Hearsay\RequireJSBundle\Tests\Templating\Helper\RequireJSHelperTest::testDefaultInitialization
    Missing argument 4 for Hearsay\RequireJSBundle\Templating\Helper\RequireJSHelper::__construct(), called in C:\wamp\www_test\inc\core\vendor\hearsay\require-js-bundle\Hearsay\RequireJSBundle\Tests\Templating\Helper\RequireJSHelperTest.php on line 54 and defined

C:\wamp\www_test\inc\core\vendor\hearsay\require-js-bundle\Hearsay\RequireJSBundle\Templating\Helper\RequireJSHelper.php:66
C:\wamp\www_test\inc\core\vendor\hearsay\require-js-bundle\Hearsay\RequireJSBundle\Tests\Templating\Helper\RequireJSHelperTest.php:54

  1. Hearsay\RequireJSBundle\Tests\Templating\Helper\RequireJSHelperTest::testConfigurationSuppressed
    Missing argument 4 for Hearsay\RequireJSBundle\Templating\Helper\RequireJSHelper::__construct(), called in C:\wamp\www_test\inc\core\vendor\hearsay\require-js-bundle\Hearsay\RequireJSBundle\Tests\Templating\Helper\RequireJSHelperTest.php on line 75 and defined

C:\wamp\www_test\inc\core\vendor\hearsay\require-js-bundle\Hearsay\RequireJSBundle\Templating\Helper\RequireJSHelper.php:66
C:\wamp\www_test\inc\core\vendor\hearsay\require-js-bundle\Hearsay\RequireJSBundle\Tests\Templating\Helper\RequireJSHelperTest.php:75

  1. Hearsay\RequireJSBundle\Tests\Templating\Helper\RequireJSHelperTest::testMainScriptIncluded
    Missing argument 4 for Hearsay\RequireJSBundle\Templating\Helper\RequireJSHelper::__construct(), called in C:\wamp\www_test\inc\core\vendor\hearsay\require-js-bundle\Hearsay\RequireJSBundle\Tests\Templating\Helper\RequireJSHelperTest.php on line 97 and defined

C:\wamp\www_test\inc\core\vendor\hearsay\require-js-bundle\Hearsay\RequireJSBundle\Templating\Helper\RequireJSHelper.php:66
C:\wamp\www_test\inc\core\vendor\hearsay\require-js-bundle\Hearsay\RequireJSBundle\Tests\Templating\Helper\RequireJSHelperTest.php:97

RequireJSBundle should use assets_base_urls

I use the following config in my config.yml to enable CDN:

framework:
    templating:
        engines: ['twig']
        assets_base_urls:
            http: ['http://cdn.example.com']

I think RequireJSBundle should use assets_base_urls the settings too.

Is there any other way we can enable CDN?

directories specified in the array "paths" in yml configuration file are not processed correctly

part of my yml configuration file:

hearsay_require_js:
  initialize_template: HearsayRequireJSBundle::initialize.html.twig
  base_dir: "%kernel.root_dir%/Resources/public/js"
  base_url: "compiled/js/require"
  paths:
    global: "%kernel.root_dir%/Resources/global/js"

Actual result in generated config:

var require={"baseUrl":"/compiled/js/require","locale":"en","paths":{"global":"/compiled/js/require/global/js"

Expected result in generated config:

var require={"baseUrl":"/compiled/js/require","locale":"en","paths":{"global":"/compiled/js/require/global"

As you can see, js subdirectory is redundant here:
/compiled/js/require/global__/js__

Scripts are not accessible

The documentation indicates that scripts should be kept in %kernel.root_dir%/scripts and Resources/scripts under your bundle. Neither of these are accessible and I don't see anything in your bundle that handles requests to /app_dev.php/js. I want to keep the original javascript files private and only expose optimized/uglified files. Am I missing something or does this bundle not do that?

Packages/paths with .js in the name cannot be used

In the 1.0 branch you cannot use any paths that have .js anywhere in them (for example twitter libraries such hogan.js and typeahead.js when installed with bower both include folders in their paths with .js in them). This problem is being caused by .js being replaced with '' in HearsayRequireJSExtension. I believe this should just only be replacing the .js at the end of the path string.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.