0.2.167 • Published 8 years ago

pancakes-angular v0.2.167

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

pancakes-angular

The purpose of this plugin is render HTML and generate JavaScript code that uses AngularJS syntax on both the client and server. There are three major pieces to this repo:

  1. transformers - A set of node.js modules that are used by a command line tool (i.e. gulp) to transform pancakes modules to client side AngularJS code. See gulp-pancakes for details on how to run the command line tool.
  2. ngapp - A set of AngularJS services and providers used by the generated pancakes code.
  3. middleware - These modules are are used by the server side framework to generate HTML on the server side from templates that contain AngularJS markup.

Installation

TBD

npm install pancakes-angular

Transformers

The idea behind the transformers is simple. Take isomorphic code and transform it into client side code. The steps are as follows:

  1. Have gulp (or another build tool) send in the file with some meta data about the type of tranformation that is needed.
  2. Gulp will forward this to the appropriate transformer.
  3. That transformer will then take combine data and code from the input file with a doT template.
  4. The resulting code that is generated is outputed to a file.
  5. Gulp can then concat and minify all the files into one package that is sent down to the client.

ngapp

Much of the code here can/should be overriden by an app written on top of pancakes. However, there are a couple key pieces that are used as the foundation of the generated code. This includes:

  • tpl.helper - There are a number of patterns used which are simplified through the use of this utility. Instead of generating duplicate code, common patterns are abstracted into this utility so that the generated code is just the DRY input into this utility. For example, setting default values in a controller.
  • state.loader - This utility is used within the config section to load a route configuration into the UI Router
  • generic.directives - There are a number of auto-generated directives that are missing from Angular. These directives are used to set the values of other attributes (or the inner HTML) and come in the following forms: f- : These will run the string value through either the i18n or staticFile filter as appropriate. For example, f-src="/yo" would result in src="http://www.pathtocdn.com/yo" or f-placeholder="hello" in a spanish context would result in placeholder="hola". b- : These will bind a value to the target attribute. This is similiar to ng-bind but for other values such as b-placeholder="variable1". bf- : This does a bind and then does a filter. bo- or bfo- : This will do the same as b- or bf- above except the bind will be a one time binding.
  • ajax - Wraps $http and is used by generated service and model code to make API calls.
  • client.event.bus - This service uses a scope to facilitate event communication throughout the app.

middleware

The first thing to realize with rendering AngularJS on the server is that we are only interested in rendering the initial page. We don't care about any AngularJS code executed after the initial load or which is only used to help bootstrap AngularJS on the client.

Also, certain things like routing and utilities (i.e. AngularJS services) are developed in a generic way (see panckes documentation for more details on these), so there is no need for doing an Angular-specific translation.

What is left then?

  1. Filters - We need to use filters on the client and the server. lib/middleware/jng.filters will simply add all the filters to the model so they are accessible as the page is rendered.
  2. Directives - For performance and decoupling, all directives are registered with the template engine (Jangular) as soon as the system starts. This means that the template objects for all partials in your app will be in memory at all times. When a page renders, the template object will be married with a model in order to generate HTML.
  3. Pages - Unlike directives, pages are not compiled until runtime. lib/middleware/jng.pages will render the page along with any directives it uses and then (optionally) put the resulting HTML inside a layout. There are a couple variations of how this can work.
0.2.167

8 years ago

0.2.166

8 years ago

0.2.165

8 years ago

0.2.163

8 years ago

0.2.162

8 years ago

0.2.161

8 years ago

0.2.160

8 years ago

0.2.159

8 years ago

0.2.158

8 years ago

0.2.157

8 years ago

0.2.156

8 years ago

0.2.155

8 years ago

0.2.154

8 years ago

0.2.153

8 years ago

0.2.152

8 years ago

0.2.151

8 years ago

0.2.150

8 years ago

0.2.149

8 years ago

0.2.148

8 years ago

0.2.147

8 years ago

0.2.146

8 years ago

0.2.145

8 years ago

0.2.144

8 years ago

0.2.143

8 years ago

0.2.142

8 years ago

0.2.141

8 years ago

0.2.140

8 years ago

0.2.139

8 years ago

0.2.138

8 years ago

0.2.137

9 years ago

0.2.136

9 years ago

0.2.135

9 years ago

0.2.134

9 years ago

0.2.133

9 years ago

0.2.132

9 years ago

0.2.131

9 years ago

0.2.130

9 years ago

0.2.129

9 years ago

0.2.128

9 years ago

0.2.127

9 years ago

0.2.126

9 years ago

0.2.124

9 years ago

0.2.123

9 years ago

0.2.122

9 years ago

0.2.120

9 years ago

0.2.119

9 years ago

0.2.118

9 years ago

0.2.117

9 years ago

0.2.116

9 years ago

0.2.115

9 years ago

0.2.114

9 years ago

0.2.113

9 years ago

0.2.112

9 years ago

0.2.111

9 years ago

0.2.110

9 years ago

0.2.109

9 years ago

0.2.108

9 years ago

0.2.107

9 years ago

0.2.106

9 years ago

0.2.105

9 years ago

0.2.104

9 years ago

0.2.103

9 years ago

0.2.102

9 years ago

0.2.101

9 years ago

0.2.100

9 years ago

0.2.99

9 years ago

0.2.98

9 years ago

0.2.97

9 years ago

0.2.96

9 years ago

0.2.95

9 years ago

0.2.94

9 years ago

0.2.93

9 years ago

0.2.92

9 years ago

0.2.91

9 years ago

0.2.90

9 years ago

0.2.89

9 years ago

0.2.88

9 years ago

0.2.87

9 years ago

0.2.86

9 years ago

0.2.85

9 years ago

0.2.84

9 years ago

0.2.83

9 years ago

0.2.81

9 years ago

0.2.80

9 years ago

0.2.79

9 years ago

0.2.78

9 years ago

0.2.77

9 years ago

0.2.76

9 years ago

0.2.75

9 years ago

0.2.74

9 years ago

0.2.73

9 years ago

0.2.72

9 years ago

0.2.71

9 years ago

0.2.70

9 years ago

0.2.69

9 years ago

0.2.68

9 years ago

0.2.67

9 years ago

0.2.66

9 years ago

0.2.65

9 years ago

0.2.64

9 years ago

0.2.63

9 years ago

0.2.62

9 years ago

0.2.61

9 years ago

0.2.60

9 years ago

0.2.59

9 years ago

0.2.58

9 years ago

0.2.57

9 years ago

0.2.56

9 years ago

0.2.55

9 years ago

0.2.54

9 years ago

0.2.53

9 years ago

0.2.52

9 years ago

0.2.51

9 years ago

0.2.50

9 years ago

0.2.49

9 years ago

0.2.48

9 years ago

0.2.47

9 years ago

0.2.46

9 years ago

0.2.45

9 years ago

0.2.44

9 years ago

0.2.43

9 years ago

0.2.42

9 years ago

0.2.41

9 years ago

0.2.40

9 years ago

0.2.39

9 years ago

0.2.38

9 years ago

0.2.37

9 years ago

0.2.36

9 years ago

0.2.35

9 years ago

0.2.34

9 years ago

0.2.33

9 years ago

0.2.32

9 years ago

0.2.31

9 years ago

0.2.30

9 years ago

0.2.29

9 years ago

0.2.28

9 years ago

0.2.27

9 years ago

0.2.26

9 years ago

0.2.25

9 years ago

0.2.24

9 years ago

0.2.23

9 years ago

0.2.22

9 years ago

0.2.21

9 years ago

0.2.20

9 years ago

0.2.19

10 years ago

0.2.18

10 years ago

0.2.17

10 years ago

0.2.16

10 years ago

0.2.13

10 years ago

0.2.15

10 years ago

0.2.14

10 years ago

0.2.12

10 years ago

0.2.11

10 years ago

0.2.10

10 years ago

0.2.9

10 years ago

0.2.8

10 years ago

0.2.7

10 years ago

0.2.6

10 years ago

0.2.5

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.110

10 years ago

0.1.109

10 years ago

0.1.108

10 years ago

0.1.107

10 years ago

0.1.106

10 years ago

0.1.105

10 years ago

0.1.104

10 years ago

0.1.103

10 years ago

0.1.102

10 years ago

0.1.101

10 years ago

0.1.100

10 years ago

0.1.99

10 years ago

0.1.98

10 years ago

0.1.97

10 years ago

0.1.96

10 years ago

0.1.95

10 years ago

0.1.94

10 years ago

0.1.93

10 years ago

0.1.92

10 years ago

0.1.91

10 years ago

0.1.90

10 years ago

0.1.89

10 years ago

0.1.88

10 years ago

0.1.87

10 years ago

0.1.86

10 years ago

0.1.85

10 years ago

0.1.84

10 years ago

0.1.83

10 years ago

0.1.82

10 years ago

0.1.81

10 years ago

0.1.80

10 years ago

0.1.79

10 years ago

0.1.78

10 years ago

0.1.77

10 years ago

0.1.76

10 years ago

0.1.75

10 years ago

0.1.74

10 years ago

0.1.73

10 years ago

0.1.72

10 years ago

0.1.71

10 years ago

0.1.70

10 years ago

0.1.69

10 years ago

0.1.68

10 years ago

0.1.67

10 years ago

0.1.66

10 years ago

0.1.65

10 years ago

0.1.64

10 years ago

0.1.63

10 years ago

0.1.62

10 years ago

0.1.61

10 years ago

0.1.60

10 years ago

0.1.59

10 years ago

0.1.58

10 years ago

0.1.57

10 years ago

0.1.56

10 years ago

0.1.55

10 years ago

0.1.54

10 years ago

0.1.52

10 years ago

0.1.50

10 years ago

0.1.48

10 years ago

0.1.47

10 years ago

0.1.46

10 years ago

0.1.45

10 years ago

0.1.44

10 years ago

0.1.43

10 years ago

0.1.42

10 years ago

0.1.41

10 years ago

0.1.40

10 years ago

0.1.35

10 years ago

0.1.34

10 years ago

0.1.33

10 years ago

0.1.32

10 years ago

0.1.31

10 years ago

0.1.30

10 years ago

0.1.29

10 years ago

0.1.28

10 years ago

0.1.27

10 years ago

0.1.26

10 years ago

0.1.25

10 years ago

0.1.22

10 years ago

0.1.21

10 years ago

0.1.20

10 years ago

0.1.16

10 years ago

0.1.15

10 years ago

0.1.14

10 years ago

0.1.13

10 years ago

0.1.12

10 years ago

0.1.11

10 years ago

0.1.10

10 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago