M
M
Marty McFly2021-01-20 13:58:58
1C-Bitrix
Marty McFly, 2021-01-20 13:58:58

How to structure website files when working with @bitrix/cli?

Greetings!
I'm trying to deal with @bitrix/cli, but there's too little information.

The information in the documentation says:

First of all, @bitrix/cli is designed to work with "extensions", site templates and component templates.

Okay, that seems to be what you need.

I create a template folder in local/templates:
6008077a5c5ae387260890.png

  • /src - sources
  • js/bundle.js - js bundle respectively
  • template_styles.css - css bundle


config bundle.config.js:

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

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


It seems that everything, I enter the cherished bitrix build and ...
60080d9543cbe987309425.png

Everything works, but
  • The config.php file is created at the root of the template, which, as I understand it, is needed only for extensions
  • The bundle is written to template_styles.css , but the bundle.css file is also created in / js , and not identical to the first one, but without prefixes.
  • js shows empty dist folder


In general, various garbage is created, which of course I would not like to have, maybe someone knows how to avoid this?

Another question - there are components for elements with logic, there are extensions for interactive js elements, but I also want to break the layout into bam blocks and take them into separate entities, I don’t understand where to store them and how to collect them if they often have js files No?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Nikolaev, 2021-01-20
@gromdron

You have not understood the structure of the product and are trying to bring something to Bitrix that it is not designed for in principle. Read first: https://dev.1c-bitrix.ru/learning/course/index.php...
There are extensions (extension).
These are JS libraries included on pages. They are located in /local/js/* or /bitrix/js/*
Documentation: https://dev.1c-bitrix.ru/learning/course/index.php...
There are site templates (template).
They are located in /local/templates/* or /bitrix/templates/*
Documentation: https://dev.1c-bitrix.ru/learning/course/index.php...
Documentation for @bitrix/cli: https:/ /dev.1c-bitrix.ru/learning/course/index.php...
The question about the organization of the code / logic should be highlighted in a separate question.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question