Cannot add requirejs-text plugin in brunch-with-marionette application

114 views Asked by At

I used brunch-with-marionette skeleton available at: https://github.com/SimbCo/brunch-with-marionette Everything works fine for me but I don't know the necessary configuration in this skeleton to add requirejs-text plugin. I tried:

npm install requirejs-text

and it installed the plugin in node-modules folder but then when I tried to load a template like this:

items = require 'text!views/sub-menu/templates/panel'

the browser gives error about being unable to load file 'text!views/....'. It considers the whole thing a file name. Removing the "text!" part works but then it doesn't return the html text rather, it gives a function which is not what I need.

I even checked the installed plugin with "npm ls" command from the app folder but when it lists the node-modules, it says the following for requirejs-text:

npm ERR! extraneous: [email protected]

I am working on this stuff for the first time. Kindly help me with the configuration to add requirejs-text plugin. Many thanks!

EDITED:

I am using coffeescript. Adding some code from search-menu-view.coffee file for reference:

SubMenuView = require 'views/sub-menu/sub-menu-view'
favorites = require 'models/favorites'
navTemplate = require 'text!views/sub-menu/templates/menu-panel'

module.exports = class SearchMenuView extends SubMenuView
    template: 'views/sub-menu/templates/menu-search'
    events:
        'click .menu-search-btn-group': 'onSearchInputClick'

The first two files load fine. The third one which has text! in it, doesn't.

0

There are 0 answers