Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

node-sass + libsass source coupling #744

Closed
saper opened this issue Mar 9, 2015 · 8 comments
Closed

node-sass + libsass source coupling #744

saper opened this issue Mar 9, 2015 · 8 comments

Comments

@saper
Copy link
Member

saper commented Mar 9, 2015

For better packaging I would like to have a complete source of the project in a single zip file.
Normally this is not a problem in Github, since I can simply pulls the zip file of every commit:
(e.g. https://github.com/sass/node-sass/archive/v2.0.1.zip)

Due to our use of submodules, however, the zipfile does not include a proper version of libsass as well as test specs are missing (I normally do not need them).

There are few possible solutions:

  1. include libsass in our git and have one .zip file including libsass and our node bindings.
  2. download two zipfiles separately, e.g. https://github.com/sass/node-sass/archive/v2.0.1.zip and https://github.com/sass/libsass/archive/3.1.0.zip
  3. teach node-sass to use an out-of-tree libsass (use extracted sources or use a library)

My preferred solution would be 3, is that feasible?

@am11
Copy link
Contributor

am11 commented Mar 9, 2015

Thanks for your proposal.
This is similar to #389, which is actively under consideration at #712 and ultimately tackled by #743. Lets discuss it at #712.

The idea really is to make user point to any libsass commit and recompile the binary. The steps which our script might follow would be:

# in node-sass root directory
#
# when user will run `node scripts/update` (just an example command)
#
# read the value of npmSassConfig.libsass
# from package.json, which is the SHA1 commit hash
# to libsass. Then:
git clone https://github.com/sass/libsass src/libsass
git reset --hard my_favourite_SHA1_commit_hash
npm update    # installs missing dev dependencies
node scripts/build -f

I think people can do all that today manually. This little automation will not bringing an extraordinary advantage anyway..
(honestly its like four commands to hack your way in!)


Due to our use of submodules, however, the zipfile does not include a proper version of libsass

What do you mean, can you expand on it? The packaged libsass code is always pointing to the version of libsass we are releasing node-sass against.

as well as test specs are missing

Yes and new we have removed the entire test directory from the production package for vNext. User can always use git to pull it. The idea really is to keep the package size as slim as possible.

Now that you have mentioned, I will remove libsass from package as well. 😉

@saper
Copy link
Member Author

saper commented Mar 9, 2015

I read #712 and #743 and came to the conclusion they are about binary package downloads, i.e. package with an already compiled binding file.

What most packagers need is just a version number and a source file corresponding to this version.

During an automated build it is much simpler to get a .zip file than play with git. I have an automated build that installs clean-room operating system, nodejs/iojs, npm and all dependencies - it fetches
source zipfiles, produces binary packages and installs them as necessary. This is all automated. I do not fetch python, node and other dependencies from git - the build system compiles them once into the binary package and unless something changes I am using those packages for testing. Each packages has a version number, not Git hash.

Besides, users of the package want to know that they have 2.0.1 and they can upgrade to, say, 2.0.2 and not use git hashes only. (Again, this is not a binary executable as in http://github.com/sass/node-sass-binaries but a complete binary package which can be installed with tar, without even calling npm).

This is similar to #389 problem, but instead of checking some code into src/libsass using git it might be better to point to existing libsass sources or even compiled binary. If we don't want to link shared libsass library, we can always use shared one (libsass.a).

@am11
Copy link
Contributor

am11 commented Mar 9, 2015

What most packagers need is just a version number and a source file corresponding to this version.

Today with v2.0.1, if you try require('node-sass').info(), you get node-sass and the corresponding libsass versions. Also you can require('path/to/node-sass/package.json').libsass to get only libsass version. See package.json#L4.

@saper
Copy link
Member Author

saper commented Mar 9, 2015

But this works only after the the module has been built...

> require('node-sass').info()
Error: `libsass` bindings not found. Try reinstalling `node-sass`?
    at getBinding (/home/saper/sw/test2/node_modules/node-sass/lib/index.js:22:11)
    at Object.<anonymous> (/home/saper/sw/test2/node_modules/node-sass/lib/index.js:188:23)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at repl:1:1
    at REPLServer.defaultEval (repl.js:132:27)

I'll try two-zip approach and will see where I can arrive at.

@saper saper changed the title node-sass + libsass source dowload node-sass + libsass source download Mar 9, 2015
@saper saper changed the title node-sass + libsass source download node-sass + libsass source coupling Mar 9, 2015
@am11
Copy link
Contributor

am11 commented Mar 9, 2015

You can also try require('./package.json').libsass.

@kevinSuttle
Copy link

Walking into this error, brought me here. How do we fix this today, and avoid this in the future?

Error: `libsass` bindings not found. Try reinstalling `node-sass`?

@am11
Copy link
Contributor

am11 commented Mar 9, 2015

@kevinSuttle, sorry to tell you this but you landed on an unrelated issue. You can search the issue tracker and find the reasons of that exception.

@am11
Copy link
Contributor

am11 commented Mar 9, 2015

Closing it as a direct duplicate of #389.
@saper, lets continue this discussion there.

@am11 am11 closed this as completed Mar 9, 2015
@saper saper mentioned this issue Mar 13, 2015
8 tasks
saper added a commit to saper/node-sass that referenced this issue Mar 15, 2015
If PKGCONFIG is set to YES in the proces
environment, use pkg-config to locate
system libsass to be linked.

This way there is no need to checkout
a src/libsass submodule at all and
the library from the package management
system can be used.

Otherwise fallback to the bundled libsass.

By default, use the bundled library.

PR: sass#139
PR: sass#389
PR: sass#744
saper added a commit to saper/node-sass that referenced this issue Mar 16, 2015
If PKGCONFIG is set to YES in the proces
environment, use pkg-config to locate
system libsass to be linked.

This way there is no need to checkout
a src/libsass submodule at all and
the library from the package management
system can be used.

Otherwise fallback to the bundled libsass.

By default, use the bundled library.

PR: sass#139
PR: sass#389
PR: sass#744
saper added a commit to saper/node-sass that referenced this issue Mar 16, 2015
Use environment variables to control
how libsass is linked:

LIBSASS_EXT variable empty or unset

Build a bundled libsass source
(from src/libsass).
This is the default.

LIBSASS_EXT=auto

libsass is located using pkg-config
and linked dynamically

LIBSASS_EXT=yes
LIBSASS_CFLAGS=
LIBSASS_LDFLAGS=

Link libsass manually, by adding
compiler flags and linker flags
in LIBSASS_CFLAGS and LIBSASS_LDFLAGS,
respectively.

For example this way libsass can
be linked in statically (on Unix):

LIBSASS_EXT=yes
LIBSASS_CFLAGS=-I/usr/local/include
LIBSASS_LDFLAGS=/usr/local/lib/libsass.a

When using LIBSASS_EXT there is no need
to checkout the libsass source into src/libsass submodule
and the library from the package management
system can be used.

PR: sass#139
PR: sass#389
PR: sass#744
saper added a commit to saper/node-sass that referenced this issue Mar 16, 2015
Use environment variables to control
how libsass is linked:

LIBSASS_EXT variable empty or unset

Build a bundled libsass source
(from src/libsass).
This is the default.

LIBSASS_EXT=auto

libsass is located using pkg-config
and linked dynamically

LIBSASS_EXT=yes
LIBSASS_CFLAGS=
LIBSASS_LDFLAGS=

Link libsass manually, by adding
compiler flags and linker flags
in LIBSASS_CFLAGS and LIBSASS_LDFLAGS,
respectively.

For example this way libsass can
be linked in statically (on Unix):

LIBSASS_EXT=yes
LIBSASS_CFLAGS=-I/usr/local/include
LIBSASS_LDFLAGS=/usr/local/lib/libsass.a

When using LIBSASS_EXT there is no need
to checkout the libsass source into src/libsass submodule
and the library from the package management
system can be used.

PR: sass#139
PR: sass#389
PR: sass#744
saper added a commit to saper/node-sass that referenced this issue Mar 16, 2015
Use environment variables to control
how libsass is linked:

LIBSASS_EXT variable empty or unset

Build a bundled libsass source
(from src/libsass).
This is the default.

LIBSASS_EXT=auto

libsass is located using pkg-config
and linked dynamically

LIBSASS_EXT=yes
LIBSASS_CFLAGS=
LIBSASS_LDFLAGS=

Link libsass manually, by adding
compiler flags and linker flags
in LIBSASS_CFLAGS and LIBSASS_LDFLAGS,
respectively.

For example this way libsass can
be linked in statically (on Unix):

LIBSASS_EXT=yes
LIBSASS_CFLAGS=-I/usr/local/include
LIBSASS_LDFLAGS=/usr/local/lib/libsass.a

When using LIBSASS_EXT there is no need
to checkout the libsass source into src/libsass submodule
and the library from the package management
system can be used.

PR: sass#139
PR: sass#389
PR: sass#744
saper added a commit to saper/node-sass that referenced this issue Mar 16, 2015
Use environment variables to control
how libsass is linked:

LIBSASS_EXT variable empty or unset

Build a bundled libsass source
(from src/libsass).
This is the default.

LIBSASS_EXT=auto

libsass is located using pkg-config
and linked dynamically

LIBSASS_EXT=yes
LIBSASS_CFLAGS=
LIBSASS_LDFLAGS=

Link libsass manually, by adding
compiler flags and linker flags
in LIBSASS_CFLAGS and LIBSASS_LDFLAGS,
respectively.

For example this way libsass can
be linked in statically (on Unix):

LIBSASS_EXT=yes
LIBSASS_CFLAGS=-I/usr/local/include
LIBSASS_LDFLAGS=/usr/local/lib/libsass.a

When using LIBSASS_EXT there is no need
to checkout the libsass source into src/libsass submodule
and the library from the package management
system can be used.

PR: sass#139
PR: sass#389
PR: sass#744
saper added a commit to saper/node-sass that referenced this issue Mar 16, 2015
Use environment variables to control
how libsass is linked:

LIBSASS_EXT variable empty or unset

Build a bundled libsass source
(from src/libsass).
This is the default.

LIBSASS_EXT=auto

libsass is located using pkg-config
and linked dynamically

LIBSASS_EXT=yes
LIBSASS_CFLAGS=
LIBSASS_LDFLAGS=

Link libsass manually, by adding
compiler flags and linker flags
in LIBSASS_CFLAGS and LIBSASS_LDFLAGS,
respectively.

For example this way libsass can
be linked in statically (on Unix):

LIBSASS_EXT=yes
LIBSASS_CFLAGS=-I/usr/local/include
LIBSASS_LDFLAGS=/usr/local/lib/libsass.a

When using LIBSASS_EXT there is no need
to checkout the libsass source into src/libsass submodule
and the library from the package management
system can be used.

PR: sass#139
PR: sass#389
PR: sass#744
saper added a commit to saper/node-sass that referenced this issue Mar 16, 2015
Use environment variables to control
how libsass is linked:

LIBSASS_EXT variable empty or unset

Build a bundled libsass source
(from src/libsass).
This is the default.

LIBSASS_EXT=auto

libsass is located using pkg-config
and linked dynamically

LIBSASS_EXT=yes
LIBSASS_CFLAGS=    compiler flags
LIBSASS_LDFLAGS=   linker flags
LIBSASS_LIBRARY=   library to link

Link libsass manually, by adding
compiler and linker flags.

For example this way libsass can
be linked in statically (on Unix):

LIBSASS_EXT=yes
LIBSASS_CFLAGS=-I/usr/local/include
LIBSASS_LIBRARY=/usr/local/lib/libsass.a

When using LIBSASS_EXT there is no need
to checkout the libsass source into src/libsass submodule
and the library from the package management
system can be used.

PR: sass#139
PR: sass#389
PR: sass#744
saper added a commit to saper/node-sass that referenced this issue Mar 16, 2015
Use environment variables to control
how libsass is linked:

LIBSASS_EXT variable empty or unset

Build a bundled libsass source
(from src/libsass).
This is the default.

LIBSASS_EXT=auto

libsass is located using pkg-config
and linked dynamically

LIBSASS_EXT=yes
LIBSASS_CFLAGS=    compiler flags
LIBSASS_LDFLAGS=   linker flags
LIBSASS_LIBRARY=   library to link

Link libsass manually, by adding
compiler and linker flags.

For example this way libsass can
be linked in statically (on Unix):

LIBSASS_EXT=yes
LIBSASS_CFLAGS=-I/usr/local/include
LIBSASS_LIBRARY=/usr/local/lib/libsass.a

When using LIBSASS_EXT there is no need
to checkout the libsass source into src/libsass submodule
and the library from the package management
system can be used.

PR: sass#139
PR: sass#389
PR: sass#744

Conflicts:
	scripts/build.js
saper added a commit to saper/node-sass that referenced this issue Mar 17, 2015
Use environment variables to control
how libsass is linked:

LIBSASS_EXT variable empty or unset

Build a bundled libsass source
(from src/libsass).
This is the default.

LIBSASS_EXT=auto

libsass is located using pkg-config
and linked dynamically

LIBSASS_EXT=yes
LIBSASS_CFLAGS=    compiler flags
LIBSASS_LDFLAGS=   linker flags
LIBSASS_LIBRARY=   library to link

Link libsass manually, by adding
compiler and linker flags.

For example this way libsass can
be linked in statically (on Unix):

LIBSASS_EXT=yes
LIBSASS_CFLAGS=-I/usr/local/include
LIBSASS_LIBRARY=/usr/local/lib/libsass.a

When using LIBSASS_EXT there is no need
to checkout the libsass source into src/libsass submodule
and the library from the package management
system can be used.

PR: sass#139
PR: sass#389
PR: sass#744
saper added a commit to saper/node-sass that referenced this issue Mar 17, 2015
Use environment variables to control
how libsass is linked:

LIBSASS_EXT variable empty or unset

Build a bundled libsass source
(from src/libsass).
This is the default.

LIBSASS_EXT=auto

libsass is located using pkg-config
and linked dynamically

LIBSASS_EXT=yes
LIBSASS_CFLAGS=    compiler flags
LIBSASS_LDFLAGS=   linker flags
LIBSASS_LIBRARY=   library to link

Link libsass manually, by adding
compiler and linker flags.

For example this way libsass can
be linked in statically (on Unix):

LIBSASS_EXT=yes
LIBSASS_CFLAGS=-I/usr/local/include
LIBSASS_LIBRARY=/usr/local/lib/libsass.a

When using LIBSASS_EXT there is no need
to checkout the libsass source into src/libsass submodule
and the library from the package management
system can be used.

PR: sass#139
PR: sass#389
PR: sass#744

Conflicts:
	scripts/build.js
saper added a commit to saper/node-sass that referenced this issue Mar 20, 2015
Use environment variables to control
how libsass is linked:

LIBSASS_EXT variable empty or unset

Build a bundled libsass source
(from src/libsass).
This is the default.

LIBSASS_EXT=auto

libsass is located using pkg-config
and linked dynamically

LIBSASS_EXT=yes
LIBSASS_CFLAGS=    compiler flags
LIBSASS_LDFLAGS=   linker flags
LIBSASS_LIBRARY=   library to link

Link libsass manually, by adding
compiler and linker flags.

For example this way libsass can
be linked in statically (on Unix):

LIBSASS_EXT=yes
LIBSASS_CFLAGS=-I/usr/local/include
LIBSASS_LIBRARY=/usr/local/lib/libsass.a

When using LIBSASS_EXT there is no need
to checkout the libsass source into src/libsass submodule
and the library from the package management
system can be used.

PR: sass#139
PR: sass#389
PR: sass#744

Conflicts:
	binding.gyp
	scripts/build.js
	src/sass_context_wrapper.h
jiongle1 pushed a commit to scantist-ossops-m2/node-sass that referenced this issue Apr 7, 2024
Special case handling for modulo with interpolants
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants