Last active
April 19, 2019 20:32
-
-
Save josfaber/231a1e283ed4bcce3618e79274d6534f to your computer and use it in GitHub Desktop.
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 -e | |
clear | |
# requirements | |
echo "Project folder name:" | |
read -e projectfolder | |
projectfolder=${projectfolder:-project} | |
# dependencies | |
npm init -y --prefix ./$projectfolder | |
npm i -D parcel-bundler node-sass npm-add-script | |
cat > ./$projectfolder/add_scripts.js <<'EOL' | |
var npmAddScript = require('npm-add-script') | |
npmAddScript({key: "serve", value: "parcel src/index.html"}) | |
EOL | |
node ./$projectfolder/add_scripts.js | |
# files | |
mkdir -p $projectfolder | |
cat > $projectfolder/index.html <<'EOL' | |
<html> | |
<body> | |
<script src="./index.js"></script> | |
</body> | |
</html> | |
EOL | |
cat > $projectfolder/index.js <<'EOL' | |
import "index.scss"; | |
console.log('init'); | |
EOL | |
cat > $projectfolder/index.scss <<'EOL' | |
body { | |
background-color:#ff0; | |
EOL | |
# cleanup | |
npm uninstall -D npm-add-script --prefix ./$projectfolder | |
rm -f ./$projectfolder/add_scripts.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment