npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-bitrix-templates-toolkit

v1.0.12

Published

Gulp Tasks для сборки шаблона 1С-Битрикс

Downloads

15

Readme

Gulp Tasks для сборки шаблона 1С-Битрикс

NPM

Build Status Dependencies

Set of configurable Gulp tasks for use in Bitrix CMS templates.

Установка

Установка с использованием пакетных менеджеров

npm:

$ npm install --save-dev gulp-bitrix-templates-toolkit

yarn:

yarn add -D gulp-bitrix-templates-toolkit

Пример gulpfile.js

Скрипт gulpfile.js следует размещать в корне шаблона оформления: local/templates/[Каталог темы]/gulpfile.js.

Списки файлов для сборки фалов стилей и скриптов поставщиков приведены для примера. Их следует заменить используемыми ресурсами в конкретном проекте.

Аналогичная ситуация с файлами шрифтов, которые размещаются в каталоге ресурсов шаблона оформления.

const MBXTemplate = require("gulp-bitrix-templates-toolkit");
MBXTemplate.initGlobal(__dirname, "https://site.ru", true);

// Стили для включения в общий файл стилей vendor.css
//
mbx.config.vendorCssSrc = [
    mbx.path.join(mbx.config.nodePath, "normalize.css/normalize.css"),
    mbx.path.join(mbx.config.nodePath, "lightbox2/src/css/lightbox.css")
];

// Скрипты для включения в общий файл скриптов vendor.js
//
mbx.config.vendorJsSrc = [
    mbx.path.join(mbx.config.nodePath, "jquery/dist/jquery.min.js"),
    mbx.path.join(mbx.config.nodePath, "jquery-match-height/dist/jquery.matchHeight-min.js"),
    mbx.path.join(mbx.config.nodePath, "owl.carousel/dist/owl.carousel.min.js"),
    mbx.path.join(mbx.config.nodePath, "lightbox2/src/js/lightbox.js")
];

// Пути к файлам шрифтов для копирования в каталог ресурсов шаблона оформления
//
const fontsSourcePath = mbx.path.join(mbx.config.srcPath, "fonts");
mbx.config.fontFiles = [
    mbx.path.join(fontsSourcePath, "font-awesome-4/fonts",      "*.+(otf|eot|svg|ttf|woff|woff2)"),
    mbx.path.join(fontsSourcePath, "roboto/fonts",              "*.+(otf|eot|svg|ttf|woff|woff2)"),
    mbx.path.join(fontsSourcePath, "robotoslab/fonts",          "*.+(otf|eot|svg|ttf|woff|woff2)")
];

MBXTemplate.initTasks();

Если пакет добавлен в проект в виде репозитория или модуля, то для инициализации константы MBXTemplate следует указать:

const MBXTemplate = require("./src/scripts");

Обработка исходных файлов по-умолчанию

Набор скриптов уже включает в себя функции сборки основных файлов шаблона оформления сайта, шаблонов оформления компонент в шаблоне сайта и шаблонов оформления собственных компонент в каталоге local/components.

Файлы стилей

Обрабатываются исходники в формате scss и sass.

| Назначение | Исходный файл | Собранный файл | | ---------------------------------- | ------------- | -------------- | | Стили шаблона | local/templates/[Каталог темы]/src/sass/.scss(sass) | local/templates/[Каталог темы]/assets/css/[file name].css | | Стили компонент шаблона | local/templates/[Каталог темы]/components/[Namespace]/[Component Name]/[Template]/src/.scss(sass) | local/templates/[Каталог темы]/components/[Namespace]/[Component Name]/[Template]/[file name].css | | Стили шаблонов локальных компонент | local/components/[Namespace]/[Component Name]/templates/[Template]/src/*.scss(sass) | local/components/[Namespace]/[Component Name]/templates/[Template]/[file name].css |

Клонирование репозитория в проект

Клонирование репозитория к себе в проект имеет смысл ТОЛЬКО при условии внесения собственных доработок в скрипты. Соотвествонно, предварительно нужно сделать Fork репозитория к себе в аккаунт.

Репозиторий должен быть размещён в каталоге local/templates/[Каталог темы]/src/scripts.

Клонирование репозитория:

$ git clone [email protected]:mvandrew/gulp-bitrix-templates-toolkit.git local/templates/[Каталог темы]/src/scripts

Добавление модулем в репозиторий проекта:

$ git submodule add [email protected]:mvandrew/gulp-bitrix-templates-toolkit.git local/templates/[Каталог темы]/src/scripts

Кроме этого, необходимо установить для него собственные зависимости:

npm:

$ cd local/templates/[Каталог темы]/src/scripts && npm install

yarn:

$ cd local/templates/[Каталог темы]/src/scripts && yarn install