Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

having to create separate path and shim for every template with require.js #92

Open
dagda1 opened this issue Mar 20, 2016 · 0 comments
Open

Comments

@dagda1
Copy link

dagda1 commented Mar 20, 2016

I have inherited an angularjs project that uses requirejs and I am (obviously) using your great project to preprocess the html files into js.

My karma.conf.js looks like this:

    preprocessors: {
      "./application/**/*.html": ["ng-html2js"]
    },

    ngHtml2JsPreprocessor: {
      stripPrefix: 'application/',
      prependPrefix: '/application/',
      moduleName: 'coms.templates'
    },

The problem I have is that I need to add an extra entry in the requirejs and paths section for every template I add, e.g.

paths: {
   angular: 'libs/vendors/angular/angular-1.4.7.min',
   angularMocks: '../node_modules/angular-mocks/angular-mocks',
   invoiceSearch: 'invoices/views/invoiceSearch.html'
},
shims: {
  'angular': {
    exports: 'angular'
  },
  angularMocks: {
    deps: [ 'angular' ],
    exports: 'angularMocks'
  },
  invoiceSearch: {
    deps: [ 'angular' ],
    exports: 'invotceSearch'
   },
}

If I don't do this then I get a can't find variable angular for every template that is not added in this way, is there a way I can create an entry for all templates?

@dagda1 dagda1 changed the title having to create separate path and shim for each template with require.js having to create separate path and shim for every template with require.js Mar 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant