Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assemble (static Site generator) With Angular JS

I want to create a site using assemble, yeoman, and angularJS. The plan is that assemble will handle content and AngularJS will handle dynamic content via a REST API. Are the two compatible, is this a good choice of architecture? My concern is with the templating engine Assemble uses (HandleBars) and whether it is compatible with AngularJS as they both seem to use {{}}. I have only started investigating but am struggling to find examples of people using a similar architecture. How do i scaffold with Yeoman?

like image 830
mr_fred Avatar asked Feb 18 '14 01:02

mr_fred


People also ask

Is Angular a static site generator?

Use our fast, simple, and powerful Angular static site generator, and build powerful pages, template based websites or web apps.

Is Angular good for static website?

The pre-render feature provided with Angular Universal allows you to quickly and easily transform an Angular application into a static website. The two main benefits are: better indexing for search engines and speed of your site (which is also a factor for search engines).

Is Angular static or dynamic?

Angular uses dynamic queries ( static: false ) by default, which simplifies queries. Developers can still explicitly set a query to static: true if necessary.

Is static site generator good?

Benefits of using a static site generator Static sites' advantages include speed, security, and SEO. They're also easy to maintain and highly scalable. Because the static site generators (SSG) store an already-compiled page on a CDN, they load a lot faster.


1 Answers

I'm doing something similar and to handle the issue with the template delimiters I use the angular interpolateProvider to change the delimiters for angular.

var app = angular.module('app', []).config(function ($interpolateProvider) {

    $interpolateProvider.startSymbol('{%');
    $interpolateProvider.endSymbol('%}');

});

I'm not sure if you can configure Yeoman to automatically use the new delimiters when running some of the scaffolds, but I hope this helps separate your templates from the assemble templates.

like image 95
doowb Avatar answered Sep 28 '22 06:09

doowb