Skip to content

Commit

Permalink
Merge pull request #174 from sass-eyeglass/symlink-install
Browse files Browse the repository at this point in the history
Add option.installWithSymlinks to toggle symlink usage
  • Loading branch information
stefanpenner committed Sep 14, 2017
2 parents 3126d85 + 2ce30e3 commit 3241a16
Show file tree
Hide file tree
Showing 4 changed files with 870 additions and 834 deletions.
1 change: 0 additions & 1 deletion .travis.yml
@@ -1,6 +1,5 @@
language: node_js
node_js:
- '0.12'
- '4'
- '5'
- '6'
Expand Down
11 changes: 8 additions & 3 deletions lib/assets/Assets.js
Expand Up @@ -4,7 +4,7 @@ var fs = require("fs-extra");
var path = require("path");
var URI = require("../util/URI");
var debug = require("../util/debug");

var ensureSymlink = require("ensure-symlink");
var AssetsCollection = require("./AssetsCollection");
// TODO - remove when deprecated AssetPathEntry is removed
var AssetsSource = require("./AssetsSource");
Expand Down Expand Up @@ -172,8 +172,13 @@ Assets.prototype.install = function(file, uri, cb) {
var dest = path.join(options.buildDir, uri);

try {
// we explicitly use copySync rather than copy to avoid starving system resources
fs.copySync(file, dest);
if (options.installWithSymlinks) {
fs.mkdirpSync(path.dirname(dest));
ensureSymlink(file, dest);
} else {
// we explicitly use copySync rather than copy to avoid starving system resources
fs.copySync(file, dest);
}
cb(null, dest);
} catch (error) {
error = new Error("Failed to install asset from " + file + "\n" + error.toString());
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -31,6 +31,7 @@
"archy": "^1.0.0",
"deasync": "^0.1.4",
"debug": "^2.2.0",
"ensure-symlink": "^1.0.0",
"fs-extra": "^0.30.0",
"glob": "^7.1.0",
"lodash.includes": "^4.3.0",
Expand Down

0 comments on commit 3241a16

Please sign in to comment.