Last active
August 15, 2017 11:32
-
-
Save matt-halliday/6b9a3a015b7a87c5b165ce1a9ae19c9b to your computer and use it in GitHub Desktop.
NPM package.json for frontend/assets building on a typical Symfony 3 project
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
{ | |
"name": "some-project", | |
"version": "1.0.0", | |
"description": "Some Project", | |
"main": "index.js", | |
"scripts": { | |
"build-task:scss-compile": "node-sass --source-map true app/Resources/scss/app.scss -o web/css", | |
"build-task:css-minify": "postcss web/css/app.css --use cssnano autoprefixer -d web/css", | |
"build-task:assets": "cp -R app/Resources/assets/ web/assets/", | |
"build-task:jquery": "cp node_modules/jquery/dist/jquery.min.js web/js/", | |
"build-task:js-compile": "jshint app/Resources && uglifyjs-folder app/Resources/ -o web/js/app.min.js", | |
"build-task:font-awesome": "cp node_modules/font-awesome/fonts/* web/assets/fonts/font-awesome", | |
"dev:watch:scss": "chokidar 'app/Resources/**/*.scss' -c 'npm run dev:build'", | |
"dev:watch:js": "chokidar 'app/Resources/**/*.js' -c 'npm run dev:build'", | |
"dev:watch": "npm-run-all -p dev:watch:*", | |
"dev:build": "mkdirp web/js web/css web/assets/fonts/font-awesome & npm-run-all -p build-task:*", | |
"dev": "npm-run-all -p dev:*" | |
}, | |
"repository": { | |
"type": "git", | |
"url": "git+https://github.com/some-org/some-project.git" | |
}, | |
"author": "", | |
"license": "ISC", | |
"bugs": { | |
"url": "https://github.com/some-org/some-project/issues" | |
}, | |
"homepage": "https://github.com/some-org/some-project#readme", | |
"devDependencies": { | |
"autoprefixer": "^7.1.2", | |
"chokidar-cli": "^1.2.0", | |
"cssnano": "^3.10.0", | |
"font-awesome": "^4.7.0", | |
"jquery": "^3.2.1", | |
"jshint": "^2.9.5", | |
"mkdirp": "^0.5.1", | |
"node-sass": "^4.5.3", | |
"npm-run-all": "^4.0.2", | |
"postcss-cli": "^4.1.0", | |
"uglifyjs-folder": "^1.1.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This NPM config is for copying and compiling assets for a typical Symfony 3 project.
It includes jQuery and FontAwesome. It will compile and minify SCSS, JavaScript and any static assets in the
assets
directory of your project. To use it, runnpm install
thennpm run dev
to compile and start the watchers. Runnpm run dev:build
to just build without watching.