GulinSS / jade-angularjs-brunch

Automatic compiler Jade templates to AngularJS modules for Brunch.IO
31 stars 21 forks source link

Subfolder Support? #6

Closed legomind closed 11 years ago

legomind commented 11 years ago

When used on folder with subfolders (/app/partials/user/dashboard.jade) the resulting modules are located under partials/dashboard.html

GulinSS commented 11 years ago

You can try special section mode (for large single page applications) which is undocummented cause not present in angular-seed:

    app/
        sections/
            user/
                 scripts/
                     ...
                 styles/
                     ...
                 templates/
                     dashboard.jade
                     ...

And such config:

    templates:
      joinTo: 
        'js/dontUseMe' : /^app/

  plugins:
    jade:
      pretty: yes # Adds pretty-indentation whitespaces to output (false by default)
    jade_angular:
      modules_folder: 'templates' # this changed
      locals: {}

After brunch compilation you get js file user.templates.js and you template pathes in javascript should be changed to something: /user/dashboard.html

Every section can be independed page, which communicates with others pages via html storage or cookie. Ofcourse you can also divide javascripts and styles of each page into independed files and attach them to html-page. Also you can use jade to involve master pages and include them into index.html's of each seactions. It will simulate casual web applications with strong server-side and pasta-client-side.