Created
March 24, 2019 18:46
-
-
Save vegarnorman/8a1da6c728b72974b92f2d658d8ca386 to your computer and use it in GitHub Desktop.
Frontend med npm scripts, Sass, PostCSS, Rollup, Babel, Autoprefixer et al
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
Show hidden characters
{ | |
"presets": ["@babel/preset-env"] | |
} |
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
last 2 version | |
> 2% in NO | |
not ie <= 11 | |
Firefox ESR |
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": "mitt-prosjekt", | |
"version": "1.0.0", | |
"description": "Eksempelprosjekt", | |
"main": "index.js", | |
"scripts": { | |
"clean": "rimraf ./dist", | |
"build:sass": "node-sass ./src/css/master.scss ./dist/assets/style.css", | |
"build:autoprefixer": "postcss ./dist/assets/style.css --output ./dist/assets/style.min.css --map", | |
"build:css": "npm run build:sass && npm run build:autoprefixer", | |
"build:rollup": "rollup -c", | |
"build:uglify": "uglifyjs ./dist/assets/app.js --compress --mangle --source-map --output ./dist/assets/app.min.js", | |
"build:js": "npm run build:rollup && npm run build:uglify", | |
"build": "npm run build:css && npm run build:js", | |
"build:prod": "npm run clean && npm run build", | |
"watch:css": " watch 'npm run build:css' ./src/css", | |
"watch:js": " watch 'npm run build:js' ./src/js", | |
"watch": "npm run watch:css & npm run watch:js", | |
"serve": "http-server ./dist -p 8080 --cors", | |
"dev": "npm run serve & npm run watch" | |
}, | |
"author": "NullSprite", | |
"license": "ISC", | |
"devDependencies": { | |
"@babel/core": "^7.2.2", | |
"@babel/preset-env": "^7.2.3", | |
"autoprefixer": "^9.4.5", | |
"copy": "^0.3.2", | |
"cssnano": "^4.1.8", | |
"http-server": "^0.11.1", | |
"node-sass": "^4.11.0", | |
"postcss": "^7.0.11", | |
"postcss-cli": "^6.1.1", | |
"rimraf": "^2.6.3", | |
"rollup": "^1.1.0", | |
"rollup-plugin-babel": "^4.3.0", | |
"rollup-plugin-node-resolve": "^4.0.0", | |
"uglify-js": "^3.4.9", | |
"watch": "^1.0.2" | |
}, | |
"dependencies": {} | |
} |
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
module.exports = { | |
plugins: [ | |
require('autoprefixer')({grid: true}), | |
require('cssnano') | |
] | |
}; |
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
import resolve from 'rollup-plugin-node-resolve'; | |
import babel from 'rollup-plugin-babel'; | |
export default { | |
input: 'src/js/index.js', | |
output: { | |
name: 'my-app', | |
file: 'dist/assets/app.js', | |
format: 'cjs' | |
}, | |
plugins: [ | |
resolve(), | |
babel({ | |
exclude: 'node_modules/**' | |
}) | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment