L
L
lightalex2021-03-21 19:53:24
Sass
lightalex, 2021-03-21 19:53:24

How to compile SCSS on the client using JS?

Greetings!
Tried to import:

import sass from 'sass';
import nodeSass from 'node-sass';

But Webpack refuses to include these packages because they refer to server packages like 'fs' and 'path', which, for obvious reasons, are not available on the client.
Can you please tell me how can I compile SCSS from a string on the client side?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Abdullaev, 2021-03-24
@avi_sdk

First of all. Give more information. Where are you trying to write it?
Secondly, I will try to answer the title. Why send a .scss file to the client? This is a preprocessor, the already assembled, processed .css file should fly into production.

D
den00014, 2021-04-22
@den00014

Working version: https://github.com/medialize/sass.js/blob/master/d...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question