├── src ├── _variables.css ├── main.css └── _sample.css ├── .gitignore ├── dist └── main.min.css ├── postcss.config.json ├── README.md ├── LICENSE └── package.json /src/_variables.css: -------------------------------------------------------------------------------- 1 | $blue: hsla(208, 100%, 85%, 1.0); 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /src/main.css: -------------------------------------------------------------------------------- 1 | @import "_variables.css"; 2 | @import "_sample.css"; 3 | -------------------------------------------------------------------------------- /dist/main.min.css: -------------------------------------------------------------------------------- 1 | h1{color:#b3dbff}h1 a{text-decoration:underline;color:inherit}@media (max-width:30em){h1{font-size:1rem}} -------------------------------------------------------------------------------- /src/_sample.css: -------------------------------------------------------------------------------- 1 | @custom-media --small-viewport (max-width: 30em); 2 | 3 | h1 { 4 | color: $blue; 5 | 6 | & a { 7 | text-decoration: underline; 8 | color: inherit; 9 | } 10 | } 11 | 12 | @media (--small-viewport) { 13 | h1 { 14 | font-size: 1rem; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /postcss.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "use": ["postcss-import", "postcss-simple-vars", "postcss-cssnext"], 3 | "input": "src/main.css", 4 | "output": "dist/main.css", 5 | "local-plugins": "true", 6 | "postcss-cssnext": { 7 | "browsers": "last 2 versions", 8 | "verbose": true 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PostCSS npm Boilerplate 2 | This is a very simple boilerplate to demonstrate how PostCSS and its ecosystem works. 3 | 4 | ## Set up 5 | 6 | 1. Clone and go to the repository 7 | 2. Install dependencies (it will automatically start the `watch` process) 8 | 9 | ``` 10 | git clone git@github.com:thefoxis/postcss-npm-boilerplate.git 11 | cd postcss-npm-boilerplate 12 | npm i 13 | ``` 14 | 15 | ## License 16 | MIT 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Karolina Szczur 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "postcss-npm-boilerplate", 3 | "version": "1.0.0", 4 | "description": "A straightforward boilerplate for using the PostCSS ecosystem via npm scripts.", 5 | "scripts": { 6 | "postinstall": "npm run watch", 7 | "watch": "onchange 'src/*.css' -- npm run build", 8 | "minify": "postcss -u cssnano dist/main.css -o dist/main.min.css", 9 | "cleanup": "del-cli dist/main.css", 10 | "build:css": "postcss -c postcss.config.json", 11 | "build": "npm run build:css && npm run minify && npm run cleanup" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/thefoxis/postcss-npm-boilerplate.git" 16 | }, 17 | "keywords": [ 18 | "modular css", 19 | "css", 20 | "postcss" 21 | ], 22 | "author": "Karolina Szczur", 23 | "license": "MIT", 24 | "bugs": { 25 | "url": "https://github.com/thefoxis/postcss-npm-boilerplate/issues" 26 | }, 27 | "homepage": "https://github.com/thefoxis/postcss-npm-boilerplate#readme", 28 | "devDependencies": { 29 | "cssnano": "^3.7.1", 30 | "del-cli": "^0.2.0", 31 | "onchange": "^2.5.0", 32 | "postcss-cli": "^2.5.2", 33 | "postcss-cssnext": "^2.6.0", 34 | "postcss-import": "^8.1.2", 35 | "postcss-simple-vars": "^2.0.0" 36 | } 37 | } 38 | --------------------------------------------------------------------------------