Last active
September 6, 2017 09:17
-
-
Save neoighodaro/900437d15a839a39889ec0c17b4d75bd to your computer and use it in GitHub Desktop.
Quickly create a Mix project for frontend prototyping! Includes Bootstrap and jQuery
This file contains hidden or 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
| # ------------------------------------------------------------ | |
| # Create a new laravel mix project | |
| # ------------------------------------------------------------ | |
| function mix() { | |
| if [[ ${1} == "new" ]]; | |
| then | |
| if [[ ! -z ${2} ]]; then mkdir -p $2 && cd $2; fi | |
| if [[ ! -f "package.json" ]]; then npm init -y; fi | |
| npm install laravel-mix browser-sync browser-sync browser-sync-webpack-plugin --save-dev | |
| npm install bootstrap-sass jquery --save | |
| cp -r node_modules/laravel-mix/setup/webpack.mix.js ./ | |
| if [[ ! -d "src" ]]; then mkdir -p src; fi | |
| if [[ ! -f "src/app.scss" ]]; then touch src/app.scss; fi | |
| if [[ ! -f "src/app.js" ]]; then touch src/app.js; fi | |
| echo "" | |
| echo "Installation complete. Add this to the scripts section of your package.json:" | |
| echo "" | |
| echo "\"scripts\": {" | |
| echo " \"dev\": \"NODE_ENV=development webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js\"," | |
| echo " \"watch\": \"NODE_ENV=development webpack --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js\"," | |
| echo " \"hot\": \"NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js\"," | |
| echo " \"production\": \"NODE_ENV=production webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js\"" | |
| echo "}" | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment