Coder Social home page Coder Social logo

bizdimensions / heroku-buildpack-nodejs-gulp-haml-sass-compass Goto Github PK

View Code? Open in Web Editor NEW

This project forked from heroku/heroku-buildpack-nodejs

0.0 3.0 0.0 8.93 MB

The official Heroku buildpack for Node.js apps.

Home Page: https://devcenter.heroku.com/articles/buildpacks

License: MIT License

Shell 100.00%

heroku-buildpack-nodejs-gulp-haml-sass-compass's Introduction

Heroku Buildpack for Node.js + Gulp + HAML + SASS + Compass

Differences to the original buildpack:

  • npm will also install dev dependencies in order to run gulp
  • it will also install HAML, SASS and Compass
  • it will detect a gulpfile.js and execute the heroku task in it

Create a heroku task

Add a heroku task to your gulpfile.js:

gulp.task('heroku', 'build');

This task will be called by the compile script. You should build everything and delegate the serving to a server used by the Procfile.

Heroku

heroku config:add BUILDPACK_URL=https://github.com/9elements/heroku-buildpack-nodejs-gulp-haml-sass-compass.git

Dokku

Create a .env file with this content to use this custom buildpack

export BUILDPACK_URL=https://github.com/9elements/heroku-buildpack-nodejs-gulp-haml-sass-compass.git

Serving the Website

This index.js file creates a static express server with password protection. It assumes that your heroku task created a build directory.

var express = require('express');
var basicAuth = require('basic-auth');
var app = express();

var auth = function (req, res, next) {
  function unauthorized(res) {
    res.set('WWW-Authenticate', 'Basic realm=Authorization Required');
    return res.send(401);
  };

  var user = basicAuth(req);

  if (!user || !user.name || !user.pass) {
    return unauthorized(res);
  };

  if (user.name === 'fancy' && user.pass === 'password') {
    return next();
  } else {
    return unauthorized(res);
  };
};


app.set('port', (process.env.PORT || 5000));
app.use(auth);
app.use(express.static(__dirname + '/build'));

app.listen(app.get('port'), function() {
  console.log("Static express server is now running at localhost:" + app.get('port'))
})

Use this Procfile to run it

web: node index.js

License

http://opensource.org/licenses/MIT

heroku-buildpack-nodejs-gulp-haml-sass-compass's People

Contributors

zeke avatar ddollar avatar sebastiandeutsch avatar rykov avatar btubbs avatar timshadel avatar hone avatar ryanbrainard avatar rwonly avatar mmcgrana avatar lackac avatar jclem avatar jacobwgillespie avatar dzuelke avatar davidjrice avatar cleishm avatar zbuc avatar

Watchers

James Cloos avatar Ben Haldenby avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.