Enhance project structure and styling for landing page. Add detailed file structure documentation in cloud.md. Update webpack configuration to support CSS Modules and SCSS. Introduce new styles for terms page and integrate them into the build process. Update package.json and package-lock.json with new dependencies for improved styling capabilities.
platform/bro-js/bro.landing/pipeline/head This commit looks good

This commit is contained in:
Primakov Alexandr Alexandrovich
2025-10-24 14:19:58 +03:00
parent 6e55a331cb
commit ebf0daacce
11 changed files with 823 additions and 120 deletions
+41 -3
View File
@@ -3,6 +3,7 @@
const path = require('path');
const pkg = require('./package');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const webpack = require('webpack');
const isProd = process.env.NODE_ENV === 'production';
@@ -18,7 +19,7 @@ module.exports = {
webpackConfig: {
entry: {
index: './src/index.tsx',
// terms страница не нужен JS, только HTML
terms: './src/terms.js', // Entry для стилей terms
},
output: {
publicPath: isProd
@@ -26,6 +27,34 @@ module.exports = {
: `/static/${pkg.name}/${process.env.VERSION || pkg.version}/`,
filename: '[name].js?[contenthash]',
},
module: {
rules: [
{
test: /\.module\.scss$/,
use: [
isProd ? MiniCssExtractPlugin.loader : 'style-loader',
{
loader: 'css-loader',
options: {
modules: {
localIdentName: isProd ? '[hash:base64:8]' : '[name]__[local]--[hash:base64:5]',
},
},
},
'sass-loader'
],
},
{
test: /\.scss$/,
exclude: /\.module\.scss$/,
use: [
isProd ? MiniCssExtractPlugin.loader : 'style-loader',
'css-loader',
'sass-loader'
],
},
],
},
plugins: [
// Главная страница (с React)
new HtmlWebpackPlugin({
@@ -33,12 +62,21 @@ module.exports = {
filename: 'index.html',
chunks: ['index'],
}),
// Terms страница (чистый HTML без JS)
// Terms страница (статика + SCSS)
new HtmlWebpackPlugin({
template: './src/terms.html',
filename: 'terms.html',
inject: false, // Не инжектим JS
chunks: isProd ? [] : ['terms'], // В production не нужен JS
cssPath: isProd
? 'https://static.brojs.ru/landing/main/terms.css'
: `/static/${pkg.name}/${process.env.VERSION || pkg.version}/terms.css`,
}),
// Извлечение CSS в отдельные файлы для production
...(isProd ? [
new MiniCssExtractPlugin({
filename: '[name].css',
})
] : []),
new webpack.DefinePlugin({
IS_PROD: process.env.NODE_ENV === 'production',
}),