Kagami / jade-pages-brunch

Adds Jade static pages support to brunch
Creative Commons Zero v1.0 Universal
7 stars 1 forks source link

jade-pages-brunch and jade-ngtemplates-brunch are incompatible #7

Closed jeandat closed 8 years ago

jeandat commented 8 years ago

Hi, here is my config file.

module.exports = {
    config: {

        modules: {
            definition: false,
            wrapper: false
        },

        files: {
            javascripts: {
                joinTo: {
                    'js/app.js': [
                        'app/index.js',
                        /^app/
                    ],
                    'js/vendor.js': 'bower_components/jquery/dist/jquery.js'
                }
            },
            stylesheets: {
                joinTo: {
                    'css/app.css': /^app/
                }
            },
            templates: {
                joinTo: {
                    'js/templates.js': /^app\/.+\/.+\.jade$/
                }
            }

        },

        plugins: {
            jadeNgtemplates: {
                modules: [{
                    name: 'templates'
                }]
            },
            jadePages: {
                pattern: /^app\/index\.jade$/
            }
        }
    }
};

If I don't install jade-pages-brunch, jade-ngtemplates-brunch work. If I install it, even if their pattern are not colliding, I got an error in jade-ngtemplates-brunch with a file which path is only relevant for jade-pages-brunch.

Here is the error :

 $ brunch b
Error while processing 'app/index.jade': Error: app/index.jade:2
    1| 
  > 2|   $templateCache.put('/app/index.jade', '<!DOCTYPE html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><base href="/"><title>Learning Angular</title><link rel="stylesheet" type="text/css" href="css/vendor.css"><link rel="stylesheet" type="text/css" href="css/app.css"></head><body><!-- Angular root scope--><div ng-app="app" ng-strict-di class="container-fluid js-app"><!-- Navbar--><nav ng-include="\'common/navbar/navbar\'" ng-controller="NavbarController" class="row"></nav><!-- Loading message--><div id="loader" ng-include="\'common/loader/loader\'" ng-controller="LoaderController"></div><!-- Breadcrumb : removed cause useless here--><!-- div.row(ng-include="\'common/breadcrumb/breadcrumb\'", ng-controller=\'BreadcrumbController\')--><!-- Views content injected here--><div ng-view autoscroll="" class="row"></div></div><script src="js/vendors.js"></script><script src="js/templates.js"></script><script src="js/app.js"></script></body></html>');

unexpected token "indent"

Here is the folder structure :

I want index.jade to be compiled in html and all others jade templates to be compiled in javascript as an angular module. So I should obtain :

Thanks

Kagami commented 8 years ago

Hi. You need to add pattern option to module object too. I was able to successfully build such configuration with:

jadeNgtemplates: {
  modules: [{
    name: 'templates',
    pattern: /^app\/.+\/.+\.jade$/
  }]
},

(It's probably a bit kludgy, but that's how things work.)

jeandat commented 8 years ago

OK. Thanks. It works indeed. My mistake.