Created
February 9, 2017 09:40
-
-
Save everdimension/c34018b600b25768746bc23f99c57664 to your computer and use it in GitHub Desktop.
A shell command for creating a folder with with files for a self-contained component.
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
#!/bin/bash | |
# Creates the following structure | |
# | - ComponentName | |
# | - ComponentName.js | |
# | - ComponentName.css | |
# | - index.js | |
createComponent() { | |
mkdir $1 | |
touch $1/$1.js | |
touch $1/$1.$2 | |
touch $1/index.js | |
echo "export { default } from './$1';" >> $1/index.js | |
} | |
componentName=$1 | |
extension=${2:-css} | |
createComponent $componentName $extension |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment