Skip to content

Instantly share code, notes, and snippets.

@matt-halliday
Last active Aug 15, 2017
Embed
What would you like to do?
NPM package.json for frontend/assets building on a typical Symfony 3 project
{
"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"
}
}
@matt-halliday

This comment has been minimized.

Copy link
Owner Author

@matt-halliday matt-halliday commented Aug 15, 2017

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, run npm install then npm run dev to compile and start the watchers. Run npm run dev:build to just build without watching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment