var fs      = require('fs');
var path    = require('path');
var sass    = require('node-sass');

module.exports = function dmpSass ($, document, done) {
  sass.render({
    file: 'assets/css/style.scss',
    outputStyle: 'compressed',
    sourceMap: false,
    success: function (result) {
      var cache = require('documark-cache')(document);
      var file = cache.fileWriteStream('sass-cache.css');
      
      file.end(result.css);
      $.root().append('<link rel="stylesheet" type="text/css" href="' + cache.filePath('sass-cache.css') + '">');
    },
    error: function (error) {
      console.log(error.message);
    }
  });

  done();
};

var fs          = require('fs');
var path        = require('path');
var sass        = require('node-sass');
var cacheHelper = require('documark-cache');

module.exports = function dmpSass ($, document, done) {
  sass.render({
    file: 'assets/css/style.scss',
    outputStyle: 'compressed',
    sourceMap: false,
    success: function (result) {
      var cache = cacheHelper(document);
      var file = cache.fileWriteStream('sass-cache.css');
      var container = $.('head');

      if ( !container.length ) {
        container = $.root();
      }

      file.end(result.css);
      container.append('<link rel="stylesheet" type="text/css" href="' + cache.filePath('sass-cache.css') + '">');

      done();
    },
    error: function (error) {
      done(error.message);
    }
  });
};

Move documark-cache dependency to top of the document. Check for head container