-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ddimitrioglo
committed
Mar 4, 2018
1 parent
834bf98
commit d7475d0
Showing
18 changed files
with
172 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
$primary-color: green; | ||
@import './styles/variables'; | ||
|
||
.jumbotron { | ||
margin: 40px 20px; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
$primary-color: blue; | ||
@import './styles/variables'; | ||
|
||
.jumbotron { | ||
margin: 40px 20px; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$primary-color: blue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
# Frequently asked questions | ||
|
||
To be updated... | ||
* **How do I get the route name from the template?** | ||
|
||
Yes, there is a build-in variable `routeName`, so you can use it in your templates `{{ routeName }}` | ||
|
||
* **Is @import supported in .scss/.sass files?** | ||
|
||
Yes, just provide a path related to "app.assets" directory. Ex: `@import './styles/variables';` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
'use strict'; | ||
|
||
const Twig = require('twig'); | ||
const logger = require('../src/logger'); | ||
|
||
/** | ||
* Twig configuration | ||
*/ | ||
Twig.extendFunction('asset', (asset) => { | ||
return asset.replace(/^@/, '/'); | ||
try { | ||
return asset.replace(/^@/, '/'); | ||
} catch (error) { | ||
logger.error(`'asset()' syntax error: ${error.message}`); | ||
} | ||
}); | ||
|
||
module.exports = Twig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
'use strict'; | ||
|
||
class Logger { | ||
/** | ||
* @param message | ||
*/ | ||
static log(message) { | ||
Logger._log(Logger.LOG, message); | ||
} | ||
|
||
/** | ||
* @param message | ||
*/ | ||
static info(message) { | ||
Logger._log(Logger.INFO, message); | ||
} | ||
|
||
/** | ||
* @param {String} message | ||
*/ | ||
static error(message) { | ||
Logger._log(Logger.ERROR, message); | ||
} | ||
|
||
/** | ||
* @param {String} type | ||
* @param {String} message | ||
* @private | ||
*/ | ||
static _log(type, message) { | ||
const time = `[${(new Date()).toISOString()}]`; | ||
|
||
switch (type) { | ||
case Logger.LOG: | ||
console.log('✅', time, message); | ||
break; | ||
case Logger.INFO: | ||
console.log('💡', time, message); | ||
break; | ||
case Logger.ERROR: | ||
console.log('❌', time, message); | ||
break; | ||
} | ||
} | ||
|
||
/** | ||
* @returns {String} | ||
* @constructor | ||
*/ | ||
static get LOG() { | ||
return 'log'; | ||
} | ||
|
||
/** | ||
* @returns {String} | ||
* @constructor | ||
*/ | ||
static get INFO() { | ||
return 'info'; | ||
} | ||
|
||
/** | ||
* @returns {String} | ||
* @constructor | ||
*/ | ||
static get ERROR() { | ||
return 'error'; | ||
} | ||
} | ||
|
||
module.exports = Logger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.