├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── Procfile ├── Readme.md ├── package.json ├── public ├── assets │ └── graphy.png └── index.html ├── sass └── main.scss └── server.js /.gitignore: -------------------------------------------------------------------------------- 1 | lib-cov 2 | *.seed 3 | *.log 4 | *.csv 5 | *.dat 6 | *.out 7 | *.pid 8 | *.gz 9 | 10 | pids 11 | logs 12 | results 13 | 14 | node_modules 15 | npm-debug.log 16 | 17 | build 18 | vagrant 19 | .lock-wscript 20 | 21 | *.css 22 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at andrewnez@gmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at [http://contributor-covenant.org/version/1/4][version] 72 | 73 | [homepage]: http://contributor-covenant.org 74 | [version]: http://contributor-covenant.org/version/1/4/ 75 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | * Fork the project. 4 | * Make your feature addition or bug fix. 5 | * Add documentation if necessary. 6 | * Add tests for it. This is important so I don't break it in a future version unintentionally. 7 | * Send a pull request. Bonus points for topic branches. 8 | 9 | ## Code of Conduct 10 | 11 | Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms. 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Andrew Nesbitt 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: node server.js -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Node-Sass Example App 2 | 3 | Example app to show how to use [node-sass](https://github.com/sass/node-sass) as a connect middleware. 4 | 5 | [ ![Codeship Status for andrew/node-sass-example](https://codeship.com/projects/cfbcb0f0-4e78-0132-9932-123ac3d7c0ec/status)](https://codeship.com/projects/47708) 6 | 7 | ## Setup 8 | 9 | git clone git@github.com:andrew/node-sass-example.git 10 | cd node-sass-example 11 | npm install 12 | node server.js 13 | open http://localhost:8000 14 | 15 | ## Note on Patches/Pull Requests 16 | 17 | * Fork the project. 18 | * Make your feature addition or bug fix. 19 | * Add tests for it. This is important so I don't break it in a 20 | future version unintentionally. 21 | (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull) 22 | * Send me a pull request. Bonus points for topic branches. 23 | 24 | ## Copyright 25 | 26 | Copyright (c) 2016 Andrew Nesbitt. See LICENSE for details. 27 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-sass-example", 3 | "version": "1.0.0", 4 | "description": "example node-sass usage", 5 | "main": "server.js", 6 | "repository": "https://github.com/andrew/node-sass-example", 7 | "keywords": [ 8 | "sass", 9 | "scss", 10 | "node-sass", 11 | "example" 12 | ], 13 | "author": "Andrew Nesbitt", 14 | "license": "MIT", 15 | "dependencies": { 16 | "connect": "^3.3.4", 17 | "node-sass-middleware": "^0.9.8", 18 | "serve-static": "^1.8.1" 19 | }, 20 | "engines": { 21 | "node": ">= 0.10.21" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /public/assets/graphy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrew/node-sass-example/2d5c0689b4b33dc2b5dd0e9884f0a0b0516a8557/public/assets/graphy.png -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Node-sass example 5 | 6 | 7 | 8 | Fork me on GitHub 9 |

Sass!

10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /sass/main.scss: -------------------------------------------------------------------------------- 1 | @import url(http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz); 2 | 3 | body{ 4 | margin:0; 5 | background: url('/assets/graphy.png'); 6 | font-family: 'Helvetica Neue', sans-serif; 7 | h1{ 8 | margin:0 auto; 9 | z-index:0; 10 | text-align:center; 11 | font-size:20em; 12 | font-family: 'Yanone Kaffeesatz', sans-serif; 13 | color:#0080FF; 14 | opacity:0.7; 15 | } 16 | h1, iframe{ 17 | width:500px; 18 | margin:0 auto; 19 | } 20 | } 21 | 22 | iframe{ 23 | background:#fff; 24 | display:block; 25 | height:320px; 26 | } 27 | -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | var connect = require('connect'); 2 | var sassMiddleware = require('node-sass-middleware'); 3 | 4 | var srcPath = __dirname + '/sass'; 5 | var destPath = __dirname + '/public/styles'; 6 | 7 | var serveStatic = require('serve-static') 8 | var http = require('http'); 9 | var port = process.env.PORT || 8000; 10 | var app = connect(); 11 | app.use('/styles', sassMiddleware({ 12 | src: srcPath, 13 | dest: destPath, 14 | debug: true, 15 | outputStyle: 'expanded' 16 | })); 17 | app.use('/', 18 | serveStatic('./public', {}) 19 | ); 20 | http.createServer(app).listen(port); 21 | console.log('Server listening on port ' + port); 22 | console.log('srcPath is ' + srcPath); 23 | console.log('destPath is ' + destPath); 24 | --------------------------------------------------------------------------------