Skip to content

Instantly share code, notes, and snippets.

View fredrikekelund's full-sized avatar

Fredrik Rombach Ekelund fredrikekelund

View GitHub Profile
@fredrikekelund
fredrikekelund / broccoli-jade path problem workaround.md
Created December 26, 2014 16:03
A workaround to Jade include paths being resolved relative to the root of the tree, not to the Jade file itself in broccoli-jade

broccoli-jade has an issue with resolving relative include paths. This issue is due to broccoli logic, not to broccoli-jade, but until something changes in either broccoli core or broccoli-jade, here's a way to work around the problem!

I solved this problem with a little bit of broccoli-static-compiler and moving my index.jade file.

First I moved all jade files to a single directory. This seems to be the way you should lay out your project if you want to work with Broccoli, since you're always pointing to directories when working with trees.

As far as Jade files in my project goes, it consists of this index.jade, which includes a bunch of partials, and a few knockout component templates. I don't want to compile the partials, but I do want to compile the components. So I laid out my project (calling the jade folder views) like this:

@fredrikekelund
fredrikekelund / AngularMeteorSync.js
Last active August 29, 2015 14:04
Angular factory to keep a Meteor collection and an Angular model in sync. You should probably use https://atmospherejs.com/urigo/angular instead.
"use strict";
// The basis for the following code is taken from https://medium.com/@zfxuan/the-wonderful-duo-using-meteor-and-angularjs-together-4d603a4651bf
var app = angular.module("DataTool.factories", [])
.factory("autorun", ["$window", function($window) {
/**
* Keeps the Angular model (attached to scope) in two-way sync with the Meteor collection.
* Attaches wrapper methods for inserting and removing items from the scope object.
* Also attaches a ready property to the scope object that changes when (you guessed
* it) the collection has loaded.