Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Сборка sass #21

Open
Galamoon opened this issue Jul 29, 2020 · 1 comment
Open

Сборка sass #21

Galamoon opened this issue Jul 29, 2020 · 1 comment

Comments

@Galamoon
Copy link

Galamoon commented Jul 29, 2020

Добрый день.
У меня вопрос возможно ли в @bitrix/cli собрать sass?
Попытка использовать плагины rollup провалилась
https://www.npmjs.com/package/rollup-plugin-scss
https://www.npmjs.com/package/rollup-plugin-sass

Команда bitrix build падает с ошибкой

01:06:54 Build extension galamoon.assets  js: 865 B
    Error: Cannot find module 'node-sass'
Require stack:
- /usr/local/lib/node_modules/@bitrix/cli/node_modules/rollup-plugin-postcss-independed/dist/rollup-plugin-postcss-independed.cjs.js
- /usr/local/lib/node_modules/@bitrix/cli/dist/rollup.config.js
- /usr/local/lib/node_modules/@bitrix/cli/dist/bitrix.build.js
- /usr/local/lib/node_modules/@bitrix/cli/bin/bitrix

local/js/galamoon/assets/bundle.config.js

const sass = require('rollup-plugin-scss');

module.exports = {
	input: 'src/js/assets.js',
	output: {js: 'dist/assets.bundle.js', css: 'dist/assets.bundle.css'},
	namespace: 'BX.Galamoon.Assets',
	plugins: {
		resolve: true,
		custom: [
			sass()
		],
	},
};

local/js/galamoon/assets/src/js/assets.js

import {Type} from 'main.core';
import styles from '../scss/main.scss';

export class Assets
{
    constructor(options = {name: 'Assets'})
    {
        this.name = options.name;
    }

    setName(name)
    {
        if (Type.isString(name))
        {
            this.name = name;
        }
    }

    getName()
    {
        return this.name;
    }
}
@vovkabelov
Copy link
Member

@Galamoon, попробуйте установить node-sass в корне экстеншна npm install node-sass или глобально node-sass install -g node-sass, должно помочь.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants