Node-sass / sass-loader alternatives - python-2.x

We are building a React app, with webpack, and I am using sass-loader which in turns it is using node-sass to convert SCSS into css.
The problem is that node-sass uses only python2.7, and I am working in a big company where they have extremely restricted policies on developer machines, where they allow only python3.x.
In order to install python2.7 I need to request an exception, which will goes to the company IT headquarter.
Is there an alternative for Node-sass that doesn't require python2.7?

node-sass does not require Python 2. Building native modules in Node.js does require Python 2 https://github.com/nodejs/node-gyp.
node-sass ships prebuilt bindings for supported platforms https://github.com/sass/node-sass#supported-nodejs-versions-vary-by-release-please-consult-the-releases-page-below-is-a-quick-guide-for-minimium-support so you should only need Python to rebuild if your network blocks downloading those files from the GitHub releases or you're running old node-sass + new Node.js versions.
If that doesn't work for you, Dart-Sass can sometimes be used as an option in those tools https://github.com/sass/dart-sass

Related

How to install Sass as a dependency with Composer?

I'm using Composer as a dependency manager for a WordPress project. I'm specifying plugins and WP-CLI as dependencies in composer.json like so:
"require": {
"johnpbloch/wordpress": "5.8.*",
"wp-cli/wp-cli-bundle": "*",
"wpackagist-plugin/akismet": "*"
}
Here's the documentation on installing WP CLI via Composer. This works great. However, I would also like to include the latest version of SASS this way, so that new people on the project can get that installed via Composer without having to do it manually.
I cannot count on everyone having npm, Chocolatey, or Homebrew, and I won't know what operating system they use.
Alternately, how could I install the latest version of SASS cross-OS via a script that Composer runs using post-install-cmd?
If there is no package for Sass (and it makes sense there wouldn't be, unless sass could be installed as a stand-alone binary or something like that), you cannot install Sass as a composer dependency
Which in any case wouldn't make much sense, since Sass cannot be a dependency for a PHP project, as it has nothing to do with PHP.
Alternately, how could I install the latest version of SASS cross-OS via a script that Composer runs using post-install-cmd?
The install instructions for Sass include no provisions for a "cross OS installer without using npm". So unles you write a script checking for the OS, what does it have installed, etc (which would be brittle and some serious overkill), you cannot automate this with a post-install-cmd.
Which again, wouldn't make a lot of sense in any case. If the package consumers need to use sass part of the project, it's a given they are developers and are capable of going through the sass requirements.
Point your package consumers to the appropriate documentation and be done.

How to work with SASS in different project?

While I was learning SASS, I have learned how to install SASS and dev-dependencies using npm package.
Now I want to work on my own project, so how should I work with SASS ?
Do I have to install SASS again ?
If not then how to use existing sass in my project and also the other dependencies like concatenation, auto pre-fixer. Especially when they are updated.

File not found when using FacebookSDK with React Native < 0.40.0

I'm using React Native 0.37.0 (because my project uses react-native-navigation which is yet to support RN >= 0.40.0) and attempting to use the Facebook SDK.
I've followed the instruction steps on react-native-fbsdk's npm page, fully; and double-checked to ensure everything is installed, all the search paths are added etc.
When running my project in XCode I get a Buildtime error in the RCTFBSDK library. In the file RCTFBSDKAppEvents.h: 'React/RCTBridgeModuke.h' file not found.
The import line in that file is the new syntax for React 0.40.0:
#import <React/RCTBridgeModule.h>
Is there anything that I can do to make these versions of frameworks play together? I need the navigation library and the facebook one, so until I find a solution I'm completely blocked.
Anything else I can share to support an answer, just ask.
Probably because you are running the latest version of react-native-fbsdk which only works with RN >= 0.40.
Try uninstall react-native-fbsdk:
npm uninstall react-native-fbsdk --save
Then, reinstall with an older version:
npm install react-native-fbsdk#0.4.0 --save

Node.js version and Heroku

So, I got a small site started in node.js (my first one) using Express. Pretty happy with it, until I tried to deploy to Heroku and found that I had 0.4.9 installed and they only support 0.4.7.
Is uninstalling 0.4.9 and installing 0.4.7 my only option, or is there a way to do a side-by-side on the two?
You can override the version of node.js and npm by customizing the Heroku build pack:
http://blog.superpat.com/2011/11/15/running-your-own-node-js-version-on-heroku/
Actually...you do not have to remove anything.
Just ensure you are using features of node compliant with node 0.4.7 and when you make your package.json which specifies your dependencies has the correct version number or range specified.
I had a similar issue where one of our developers made is packacge and set the dependency to node 0.4.8 however it didn't require this it was just what version he was using at the time, we ended up updating his package.json to list node 0.4.7 instead and then my package which depended on his deployed to heroku just fine.
It seems Heroku only supports 0.4.7 at the moment and even suggests to develop strictly on that version.
If you have to use heroku then you have to uninstall 0.4.9, install 0.4.7.
If you don't have to use heroku. You can always setup a VPS yourself, and you will have the freedom to install whatever version that pleases you. :D

How can I run SASS without installing?

I wanted to use SASS on our company's web app but I can't install any programs on production machines. Everything I searched about SASS required you to run an installation program like gem and also required HAML.
I was hoping to find just a script that processes scss files without needing to install anything else.
Well... if you have Ruby available, you could checkout the Git repository of Sass (https://github.com/nex3/sass). Do so by either typing git clone https://github.com/nex3/sass.git or just downloading it.
Then you could use the interactive Ruby console by typing irb. Try to require 'sass/lib/sass' (this one here) and run Sass.compile_file 'my_styles.css'.
Otherwise... why are you trying to do that? You can also install sass locally, run sass --watch on your sass folder and it compiles your scss files automatically into css files - which you can deploy on your production environment.
If you can run java program in your build system, you could use JRuby for compiling sass. See this answer for more details
Here's a solution for using Sass without using the command line or installing dependencies. It works with Windows, OS X, and Linux. It has a graphical interface, and no installer, just unzip and double-click.
http://scout-app.io
You can also use the java library https://github.com/scireum/server-sass which can be embedded into any java based web-app. It will compile sass on the fly and return the resulting css. This is especially useful if the Sass sources change (i.e. for customizing reasons) and an ahead of time compilation is not possible. (Note: I'm the author of the project - and it is also not yet a complete implementation of the Sass standard).
Alternatively, what you could do is:
Install Ruby
Download the Sass Gem
Navigate to download location
Run: gem install sass-3.3.4.gem
Voila! Sass is installed.
Use the online Sass compiler SassMeister. You just have to paste your sass code on the left panel and get the css code on the right.

Resources