Last active
February 15, 2017 19:15
-
-
Save kribblo/0501c8fe2e36763ebd619c8a0258ab79 to your computer and use it in GitHub Desktop.
IntelliJ File & Code Templates
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
## Inspired by https://gist.github.com/Pencroff/69ebdd4d57ad11b2eaba | |
## file name transformation | |
## file-name => FileName | |
## Sources: | |
## http://stackoverflow.com/questions/6998412/velocity-string-function | |
## http://stackoverflow.com/questions/21288687/using-velocity-split-to-split-a-string-into-an-array-doesnt-seem-to-work | |
## http://velocity.apache.org/engine/releases/velocity-1.7/apidocs/org/apache/velocity/util/StringUtils.html#split(java.lang.String, java.lang.String) | |
## File and Code Templates -> Includes -> Save as "CamelCase" | |
#set( $camelCaseName = "" ) | |
#set( $part = "" ) | |
#foreach($part in $NAME.split("-")) | |
#set( $camelCaseName = "${camelCaseName}$part.substring(0,1).toUpperCase()$part.substring(1).toLowerCase()" ) | |
#set( $camelCaseName = "$camelCaseName.substring(0,1).toLowerCase()$camelCaseName.substring(1)" ) | |
#end |
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
## Replace "HTML File" | |
## TODO: uppercase CamelCase + Space instead of dash | |
#parse("CamelCase.velocity") | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>${camelCaseName}</title> | |
</head> | |
<body> | |
<h1>${camelCaseName}</h1> | |
#[[$END$]]# | |
</body> | |
</html> |
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
## File and Code Templates -> Files -> Replace "Javascript File" | |
#parse("CamelCase.velocity") | |
const ${camelCaseName} = { | |
}; | |
module.exports = ${camelCaseName}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment