-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Allow binaries to be install from the local filesystem #1106
Comments
@flogehring this may be of interest to you. |
Yes, that and
would both be helpful for offline development or development behind annoying corporate proxies |
At present it is quite possible. Also, the install script skips the binary download (not sure if we documented it properly, these details are buried in some PR description): Bash version:mkdir /test-sass
cd /test-sass
# download / copy binding.node in /test-sass, then:
SASS_BINARY_PATH=/test-sass/binding.node npm install node-sass CMD version:mkdir \test-sass
cd \test-sass
:: download / copy binding.node in c:\test-sass, then:
SET SASS_BINARY_PATH=C:/test-sass/binding.node
:: your drive letter may vary
npm install node-sass PowerShell version:mkdir /test-sass
cd /test-sass
# download / copy binding.node in c:\test-sass, then:
$env:SASS_BINARY_PATH="C:/test-sass/binding.node"
# your drive-letter may vary
npm install node-sass
|
Argh you're totally right. Completely forgot about I'm glad I asked the question. |
I think we could consider adding support for this to |
Those two are not equivalent: SASS_BINARY_PATH points at the ultimate location of the binding file - it must match your node-sass version, architecture and the node engine. A repository pointed to by SASS_BINARY_SITE can contain multiple node versions, architectures, and engines - much like our github binary repository. I would have expected to have those re-used via some shared, but non-HTTP path in a closed environment. |
@xzyfer, we have: SASS_BINARY_NAME At the time, I thought this will suffice most of the needs for the original/first requesters, which it did. I took some inspirations form PhantomJS project. |
Tracking documentation of these, and other, ENV variables in #1143 |
If I do:
It seems it is ignored and Also tried setting a global SASS_BINARY_PATH with an absolute path but it's ignored too (and less desirable anyway). Thanks |
Unfortunately, package.json option currently is only applicable if you have the option set in node-sass' own package.json while developing node-sass. For npm-install, according to https://docs.npmjs.com/misc/scripts#packagejson-vars, we could add something like (untested): --- a/lib/extensions.js
+++ b/lib/extensions.js
@@ -191,6 +191,8 @@ function getBinaryName() {
binaryName = process.env.npm_config_sass_binary_name;
} else if (pkg.nodeSassConfig && pkg.nodeSassConfig.binaryName) {
binaryName = pkg.nodeSassConfig.binaryName;
+ } else if (process.env.npm_package_nodeSassConfig_binaryName) {
+ binaryName = process.env.npm_package_nodeSassConfig_binaryName;
} else {
variant = getPlatformVariant();
if (variant) {
@@ -270,6 +272,8 @@ function getBinaryDir() {
binaryDir = process.env.npm_config_sass_binary_dir;
} else if (pkg.nodeSassConfig && pkg.nodeSassConfig.binaryDir) {
binaryDir = pkg.nodeSassConfig.binaryDir;
+ } else if (process.env.npm_package_nodeSassConfig_binaryDir) {
+ binaryDir = process.env.npm_package_nodeSassConfig_binaryDir;
} else {
binaryDir = defaultBinaryDir;
}
@@ -302,6 +306,8 @@ function getBinaryPath() {
binaryPath = process.env.npm_config_sass_binary_path;
} else if (pkg.nodeSassConfig && pkg.nodeSassConfig.binaryPath) {
binaryPath = pkg.nodeSassConfig.binaryPath;
+ } else if (process.env.npm_package_nodeSassConfig_binaryPath) {
+ binaryPath = process.env.npm_package_nodeSassConfig_binaryPath;
} else {
binaryPath = path.join(getBinaryDir(), getBinaryName().replace(/_(?=binding\.node)/, '/'));
}
This scenario appears to be working. I have
|
Thanks @am11, I'll try SASS_BINARY_PATH again. But yes I think it would be very to have so that behind corporate firewalls a project can be installed without any extra steps! |
Originally mentioned in #1104 (comment)
Problem
Currently the binary site config, as the name suggests, needs to be a remote URL. Allowing file access might be useful for local development.
Proposed solution
Usecase
To be honest I'm not entire sure this is useful. The major usecase I see for this is offline development.
Thoughts @am11 @saper?
The text was updated successfully, but these errors were encountered: