init
This commit is contained in:
		
						commit
						feaa706ab9
					
				
							
								
								
									
										40
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,40 @@ | ||||
| # Vendor dll build | ||||
| dlls | ||||
| 
 | ||||
| # compiled output | ||||
| /dist | ||||
| /tmp | ||||
| 
 | ||||
| # dependencies | ||||
| /node_modules | ||||
| 
 | ||||
| # IDEs and editors | ||||
| /.idea | ||||
| .project | ||||
| .classpath | ||||
| .c9/ | ||||
| *.launch | ||||
| .settings/ | ||||
| *.sublime-workspace | ||||
| 
 | ||||
| # IDE - VSCode | ||||
| .vscode/* | ||||
| !.vscode/settings.json | ||||
| !.vscode/tasks.json | ||||
| !.vscode/launch.json | ||||
| !.vscode/extensions.json | ||||
| .history/* | ||||
| 
 | ||||
| # misc | ||||
| /.sass-cache | ||||
| /connect.lock | ||||
| /coverage | ||||
| /libpeerconnection.log | ||||
| npm-debug.log | ||||
| yarn-error.log | ||||
| testem.log | ||||
| /typings | ||||
| 
 | ||||
| # System Files | ||||
| .DS_Store | ||||
| Thumbs.db | ||||
							
								
								
									
										163
									
								
								package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										163
									
								
								package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @ -0,0 +1,163 @@ | ||||
| { | ||||
|   "name": "@ijl/ltemplates", | ||||
|   "version": "1.0.0", | ||||
|   "lockfileVersion": 1, | ||||
|   "requires": true, | ||||
|   "dependencies": { | ||||
|     "balanced-match": { | ||||
|       "version": "1.0.0", | ||||
|       "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", | ||||
|       "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" | ||||
|     }, | ||||
|     "brace-expansion": { | ||||
|       "version": "1.1.11", | ||||
|       "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", | ||||
|       "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", | ||||
|       "requires": { | ||||
|         "balanced-match": "^1.0.0", | ||||
|         "concat-map": "0.0.1" | ||||
|       } | ||||
|     }, | ||||
|     "commander": { | ||||
|       "version": "2.20.3", | ||||
|       "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", | ||||
|       "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", | ||||
|       "optional": true | ||||
|     }, | ||||
|     "concat-map": { | ||||
|       "version": "0.0.1", | ||||
|       "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", | ||||
|       "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" | ||||
|     }, | ||||
|     "foreachasync": { | ||||
|       "version": "3.0.0", | ||||
|       "resolved": "https://registry.npmjs.org/foreachasync/-/foreachasync-3.0.0.tgz", | ||||
|       "integrity": "sha1-VQKYfchxS+M5IJfzLgBxyd7gfPY=" | ||||
|     }, | ||||
|     "fs.realpath": { | ||||
|       "version": "1.0.0", | ||||
|       "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", | ||||
|       "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" | ||||
|     }, | ||||
|     "glob": { | ||||
|       "version": "7.1.6", | ||||
|       "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", | ||||
|       "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", | ||||
|       "requires": { | ||||
|         "fs.realpath": "^1.0.0", | ||||
|         "inflight": "^1.0.4", | ||||
|         "inherits": "2", | ||||
|         "minimatch": "^3.0.4", | ||||
|         "once": "^1.3.0", | ||||
|         "path-is-absolute": "^1.0.0" | ||||
|       } | ||||
|     }, | ||||
|     "handlebars": { | ||||
|       "version": "4.5.3", | ||||
|       "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.3.tgz", | ||||
|       "integrity": "sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA==", | ||||
|       "requires": { | ||||
|         "neo-async": "^2.6.0", | ||||
|         "optimist": "^0.6.1", | ||||
|         "source-map": "^0.6.1", | ||||
|         "uglify-js": "^3.1.4" | ||||
|       } | ||||
|     }, | ||||
|     "hbs": { | ||||
|       "version": "4.1.0", | ||||
|       "resolved": "https://registry.npmjs.org/hbs/-/hbs-4.1.0.tgz", | ||||
|       "integrity": "sha512-YDrUBtLpwRl0H5uyCGLE2LGtGJl51VvJFBj/D+Cqyr6XMopCvwXA0ynRpd87u6aVIYCeGYZHESfZzPHbNMkOPA==", | ||||
|       "requires": { | ||||
|         "handlebars": "4.5.3", | ||||
|         "walk": "2.3.14" | ||||
|       } | ||||
|     }, | ||||
|     "inflight": { | ||||
|       "version": "1.0.6", | ||||
|       "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", | ||||
|       "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", | ||||
|       "requires": { | ||||
|         "once": "^1.3.0", | ||||
|         "wrappy": "1" | ||||
|       } | ||||
|     }, | ||||
|     "inherits": { | ||||
|       "version": "2.0.4", | ||||
|       "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", | ||||
|       "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" | ||||
|     }, | ||||
|     "minimatch": { | ||||
|       "version": "3.0.4", | ||||
|       "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", | ||||
|       "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", | ||||
|       "requires": { | ||||
|         "brace-expansion": "^1.1.7" | ||||
|       } | ||||
|     }, | ||||
|     "minimist": { | ||||
|       "version": "0.0.10", | ||||
|       "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", | ||||
|       "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=" | ||||
|     }, | ||||
|     "neo-async": { | ||||
|       "version": "2.6.1", | ||||
|       "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", | ||||
|       "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==" | ||||
|     }, | ||||
|     "once": { | ||||
|       "version": "1.4.0", | ||||
|       "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", | ||||
|       "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", | ||||
|       "requires": { | ||||
|         "wrappy": "1" | ||||
|       } | ||||
|     }, | ||||
|     "optimist": { | ||||
|       "version": "0.6.1", | ||||
|       "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", | ||||
|       "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", | ||||
|       "requires": { | ||||
|         "minimist": "~0.0.1", | ||||
|         "wordwrap": "~0.0.2" | ||||
|       } | ||||
|     }, | ||||
|     "path-is-absolute": { | ||||
|       "version": "1.0.1", | ||||
|       "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", | ||||
|       "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" | ||||
|     }, | ||||
|     "source-map": { | ||||
|       "version": "0.6.1", | ||||
|       "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", | ||||
|       "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" | ||||
|     }, | ||||
|     "uglify-js": { | ||||
|       "version": "3.8.0", | ||||
|       "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.8.0.tgz", | ||||
|       "integrity": "sha512-ugNSTT8ierCsDHso2jkBHXYrU8Y5/fY2ZUprfrJUiD7YpuFvV4jODLFmb3h4btQjqr5Nh4TX4XtgDfCU1WdioQ==", | ||||
|       "optional": true, | ||||
|       "requires": { | ||||
|         "commander": "~2.20.3", | ||||
|         "source-map": "~0.6.1" | ||||
|       } | ||||
|     }, | ||||
|     "walk": { | ||||
|       "version": "2.3.14", | ||||
|       "resolved": "https://registry.npmjs.org/walk/-/walk-2.3.14.tgz", | ||||
|       "integrity": "sha512-5skcWAUmySj6hkBdH6B6+3ddMjVQYH5Qy9QGbPmN8kVmLteXk+yVXg+yfk1nbX30EYakahLrr8iPcCxJQSCBeg==", | ||||
|       "requires": { | ||||
|         "foreachasync": "^3.0.0" | ||||
|       } | ||||
|     }, | ||||
|     "wordwrap": { | ||||
|       "version": "0.0.3", | ||||
|       "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", | ||||
|       "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=" | ||||
|     }, | ||||
|     "wrappy": { | ||||
|       "version": "1.0.2", | ||||
|       "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", | ||||
|       "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										16
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,16 @@ | ||||
| { | ||||
|   "name": "@ijl/ltemplates", | ||||
|   "version": "0.0.0", | ||||
|   "description": "Templates library for @ijl projects", | ||||
|   "main": "src/index.js", | ||||
|   "scripts": { | ||||
|     "test": "echo \"Error: no test specified\" && exit 1" | ||||
|   }, | ||||
|   "keywords": [], | ||||
|   "author": "", | ||||
|   "license": "ISC", | ||||
|   "dependencies": { | ||||
|     "glob": "^7.1.6", | ||||
|     "hbs": "^4.1.0" | ||||
|   } | ||||
| } | ||||
							
								
								
									
										19
									
								
								src/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								src/index.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | ||||
| const path = require('path'); | ||||
| const hbs = require(path.resolve('node_modules', 'hbs')); | ||||
| 
 | ||||
| const registerPartialsWithExtensions = require('./utils/registerPartialsWithExtensions'); | ||||
| 
 | ||||
| function toJSON (obj) { | ||||
|     if (typeof obj === 'object') { | ||||
|         return JSON.stringify(obj) | ||||
|     } | ||||
|     return obj | ||||
| } | ||||
| 
 | ||||
| module.exports.applyHbs = (app) => { | ||||
|     const templates = path.resolve(__dirname, 'templates') | ||||
|     registerPartialsWithExtensions(hbs, templates) | ||||
|     hbs.registerHelper('toJSON', toJSON) | ||||
|     app.engine('hbs', hbs.__express) | ||||
|     app.set('views', templates) | ||||
| } | ||||
							
								
								
									
										25
									
								
								src/templates/index.hbs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								src/templates/index.hbs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,25 @@ | ||||
| <!DOCTYPE html> | ||||
| <html lang="en"> | ||||
| 
 | ||||
| <head> | ||||
|   <meta charset="UTF-8"> | ||||
|   <link href="https://fonts.googleapis.com/css?family=Montserrat:400,600,700,900&subset=cyrillic,cyrillic-ext" | ||||
|     rel="stylesheet" /> | ||||
|   <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||||
|   <meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||||
|   <title>{{ pageTitle }}</title> | ||||
| </head> | ||||
| 
 | ||||
| <body> | ||||
|   <script src="{{resourceUrl}}/inno-bootstrap/{{versionBootstrap}}/dist/index.js"></script> | ||||
|   <script> | ||||
|     bootstrap({ | ||||
|       apps: {{{ toJSON apps }}}, | ||||
|       navigations: {{{ toJSON navigations }}}, | ||||
|       config: {{{ toJSON config }}} | ||||
|     }) | ||||
|   </script> | ||||
|   <div id="app"></div> | ||||
| </body> | ||||
| 
 | ||||
| </html> | ||||
							
								
								
									
										15
									
								
								src/utils/registerPartialsWithExtensions.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								src/utils/registerPartialsWithExtensions.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | ||||
| const fs = require('fs'); | ||||
| const path = require('path'); | ||||
| 
 | ||||
| const glob = require(path.resolve('node_modules', 'glob')); | ||||
| 
 | ||||
| module.exports = (hbs, rootDir) => { | ||||
|     glob | ||||
|         .sync(`${rootDir}/**/*`, { | ||||
|             nodir: true | ||||
|         }) | ||||
|         .forEach((m) => { | ||||
|             const partialName = path.relative(rootDir, m).split(path.sep).join('/') | ||||
|             hbs.registerPartial(partialName, fs.readFileSync(m, 'utf8')) | ||||
|         }) | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user