Skip to content

Instantly share code, notes, and snippets.

@everdimension
Created February 9, 2017 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save everdimension/c34018b600b25768746bc23f99c57664 to your computer and use it in GitHub Desktop.
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.
#!/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