├── .gitattributes
├── .gitignore
├── README.md
├── bower.json
├── gulpfile.js
├── local
└── templates
│ └── main
│ ├── fonts
│ ├── SegoeUIRegular.eot
│ ├── SegoeUIRegular.ttf
│ └── SegoeUIRegular.woff
│ ├── footer.php
│ ├── header.php
│ ├── images
│ ├── krayt.png
│ └── sprite.png
│ ├── script.js
│ └── template_styles.css
├── package.json
└── src
├── fonts
├── SegoeUIRegular.eot
├── SegoeUIRegular.ttf
└── SegoeUIRegular.woff
├── images
└── krayt.png
├── js
├── partials
│ └── app.js
└── script.js
├── sprite-svg-template.scss
├── sprite-svg
└── done.svg
├── sprite-template.scss
├── sprite
└── krayt.png
└── styles
├── partials
├── fonts.scss
├── functions.scss
├── mixin.scss
├── sprite-svg.scss
├── sprite.scss
└── variables.scss
└── template_styles.scss
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | node_modules
3 | bower_components
4 | bitrix
5 | upload
6 |
7 | local/templates/main/fonts
8 | local/templates/main/images
9 | local/templates/main/script.js
10 | local/templates/main/template_styles.css
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # frontend-bitrix with bootstrap-sass
2 | for fast frontend-develop on bitrix
3 | development template should be in "local"
4 |
5 |
1. Place the files in the root
6 | 2. You need execute several commands:
7 |
8 | - npm install or npm i
9 | - bower install or bower i
10 | - gulp
11 |
12 |
13 |
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "frontend-bitrix",
3 | "version": "0.0.1",
4 | "authors": [
5 | "jmaks1 "
6 | ],
7 | "license": "MIT",
8 | "ignore": [
9 | "**/.*",
10 | "node_modules",
11 | "bower_components",
12 | "test",
13 | "tests"
14 | ],
15 | "dependencies": {
16 | "jquery": "~2.1.4",
17 | "bootstrap-sass": "~3.3.5"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/gulpfile.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | // init
4 | var gulp = require('gulp'),
5 | watch = require('gulp-watch'), // Наблюдение за изменениями файлов
6 | prefixer = require('gulp-autoprefixer'), // Автоматически добавляет вендорные префиксы к CSS свойствам
7 | uglify = require('gulp-uglify'), // Сжимать наш JS
8 | rigger = require('gulp-rigger'), // Позволяет импортировать один файл в другой простой конструкцией
9 | sass = require('gulp-sass'), // для компиляции нашего SCSS кода
10 | sourcemaps = require('gulp-sourcemaps'), // Для генерации css sourscemaps, помогает нам при отладке кода
11 | cssmin = require('gulp-minify-css'), // Сжатие CSS кода
12 | imagemin = require('gulp-imagemin'), // Сжатие картинок
13 | pngquant = require('imagemin-pngquant'), // Сжатие картинок | работа с PNG
14 | plumber = require('gulp-plumber'), // Ловим ошибки, чтобы не прервался watch
15 | svgSprite = require('gulp-svg-sprite'), // Создаем спрайт из svg
16 | svgmin = require('gulp-svgmin'), // оптимизируем наш svg
17 | svg2png = require('gulp-svg2png'), // Создадим альтернативный спрайт из svg в png
18 | spritesmith = require('gulp.spritesmith'); // Создание png спрайтов
19 |
20 |
21 | // write routs
22 | var path = {
23 | build: {
24 | js: 'local/templates/main/',
25 | styles: 'local/templates/main/',
26 | images: 'local/templates/main/images/',
27 | fonts: 'local/templates/main/fonts/',
28 | fontBootstrap: 'local/templates/main/fonts/bootstrap/'
29 | },
30 | src: {
31 | js: 'src/js/*.*',
32 | styles: 'src/styles/*.*',
33 | stylesPartials: 'src/styles/partials/',
34 | images: 'src/images/**/*.*',
35 | sprite: 'src/sprite/*.*',
36 | spriteTemplate: 'src/sprite-template.scss',
37 | spriteSvg: 'src/sprite-svg/*.*',
38 | spriteSvgTemplate: 'src/sprite-svg-template.scss',
39 | fonts: 'src/fonts/**/*.*',
40 | fontBootstrap: 'bower_components/bootstrap-sass/assets/fonts/bootstrap/*.*'
41 | },
42 | watch: {
43 | js: 'src/js/**/*.js',
44 | styles: 'src/styles/**/*.scss',
45 | images: 'src/images/**/*.*',
46 | sprite: 'src/sprite/*.*',
47 | spriteSvg: 'src/sprite-svg/*.*',
48 | fonts: 'src/fonts/**/*.*'
49 | }
50 | };
51 |
52 |
53 |
54 | // javascript
55 | gulp.task('js:build', function () {
56 | gulp.src(path.src.js) // Найдем наш main файл
57 | .pipe(plumber())
58 | .pipe(rigger()) // Прогоним через rigger
59 | .pipe(sourcemaps.init()) // Инициализируем sourcemap
60 | .pipe(uglify()) // Сожмем наш js
61 | .pipe(sourcemaps.write()) // Пропишем карты
62 | .pipe(plumber.stop())
63 | .pipe(gulp.dest(path.build.js)) // Выплюнем готовый файл в build
64 | });
65 | // png sprite
66 | gulp.task('sprite:build', function() {
67 | var spriteData =
68 | gulp.src(path.src.sprite)
69 | .pipe(spritesmith({
70 | imgName: 'sprite.png',
71 | cssName: 'sprite.scss',
72 | cssFormat: 'scss',
73 | algorithm: 'binary-tree',
74 | padding: 5,
75 | cssTemplate: path.src.spriteTemplate,
76 | cssVarMap: function(sprite) {
77 | sprite.name = 's-' + sprite.name
78 | }
79 | }));
80 |
81 | spriteData.img.pipe(gulp.dest(path.build.images));
82 | spriteData.css.pipe(gulp.dest(path.src.stylesPartials));
83 | });
84 | // svg sprite
85 | gulp.task('spriteSvg:build', function () {
86 | gulp.src(path.src.spriteSvg)
87 | .pipe(plumber())
88 | .pipe(svgmin())
89 | .pipe(svgSprite({
90 | "shape": {
91 | "spacing": {
92 | "padding": 5,
93 | },
94 | },
95 | "mode": {
96 | "css": {
97 | "dest": "./",
98 | "layout": "diagonal",
99 | "sprite": path.build.images+"sprite-svg.svg",
100 | "bust": false,
101 | "render": {
102 | "scss": {
103 | "dest": path.src.stylesPartials+'sprite-svg.scss',
104 | "template": path.src.spriteSvgTemplate
105 | }
106 | }
107 | }
108 | }
109 | }))
110 | .pipe(plumber.stop())
111 | .pipe(gulp.dest("./"));
112 | });
113 | // svg to png sprite | for ie
114 | gulp.task('svg2png', function() {
115 | gulp.src(path.build.images+"sprite-svg.svg")
116 | .pipe(plumber())
117 | .pipe(svg2png())
118 | .pipe(plumber.stop())
119 | .pipe(gulp.dest(path.build.images));
120 | });
121 | // images
122 | gulp.task('image:build', function () {
123 | gulp.src(path.src.images)
124 | .pipe(plumber())
125 | .pipe(imagemin({
126 | progressive: true,
127 | svgoPlugins: [{removeViewBox: false}],
128 | use: [pngquant()],
129 | interlaced: true
130 | }))
131 | .pipe(plumber.stop())
132 | .pipe(gulp.dest(path.build.images))
133 | });
134 | // move bootstrap icons(font) to build
135 | gulp.task('icons:build', function() {
136 | gulp.src(path.src.fontBootstrap)
137 | .pipe(gulp.dest(path.build.fontBootstrap));
138 | });
139 | // move custom fonts to build
140 | gulp.task('fonts:build', function() {
141 | gulp.src(path.src.fonts)
142 | .pipe(gulp.dest(path.build.fonts))
143 | });
144 | // styles
145 | gulp.task('styles:build', function () {
146 | gulp.src(path.src.styles) // Выберем наш main.scss
147 | .pipe(plumber())
148 | .pipe(sourcemaps.init()) // То же самое что и с js
149 | .pipe(sass()) // Скомпилируем
150 | .pipe(prefixer()) // Добавим вендорные префиксы
151 | .pipe(cssmin()) // Сожмем
152 | .pipe(sourcemaps.write()) // Пропишем карты
153 | .pipe(plumber.stop())
154 | .pipe(gulp.dest(path.build.styles)) // И в build
155 | });
156 |
157 |
158 | gulp.task('build', [
159 | 'js:build',
160 | 'sprite:build',
161 | 'spriteSvg:build',
162 | 'image:build',
163 | 'icons:build',
164 | 'fonts:build',
165 | 'styles:build',
166 | ]);
167 |
168 | gulp.task('watch', function(){
169 | watch([path.watch.js], function(event, cb) {
170 | gulp.start('js:build');
171 | });
172 | watch([path.watch.sprite], function(event, cb) {
173 | gulp.start('sprite:build');
174 | });
175 | watch([path.watch.spriteSvg], function(event, cb) {
176 | gulp.start('spriteSvg:build');
177 | });
178 | // watch for sprite-svg
179 | watch([path.build.images+"sprite-svg.svg"], function(event, cb) {
180 | gulp.start('svg2png');
181 | });
182 | watch([path.watch.images], function(event, cb) {
183 | gulp.start('image:build');
184 | });
185 | watch([path.watch.fonts], function(event, cb) {
186 | gulp.start('fonts:build');
187 | });
188 | watch([path.watch.styles], function(event, cb) {
189 | gulp.start('styles:build');
190 | });
191 | });
192 |
193 | gulp.task('default', ['build', 'watch']);
--------------------------------------------------------------------------------
/local/templates/main/fonts/SegoeUIRegular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jmaks1/bitrix-frontend/9c165873f9710d0e0fd2be91fd81a879445f06cc/local/templates/main/fonts/SegoeUIRegular.eot
--------------------------------------------------------------------------------
/local/templates/main/fonts/SegoeUIRegular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jmaks1/bitrix-frontend/9c165873f9710d0e0fd2be91fd81a879445f06cc/local/templates/main/fonts/SegoeUIRegular.ttf
--------------------------------------------------------------------------------
/local/templates/main/fonts/SegoeUIRegular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jmaks1/bitrix-frontend/9c165873f9710d0e0fd2be91fd81a879445f06cc/local/templates/main/fonts/SegoeUIRegular.woff
--------------------------------------------------------------------------------
/local/templates/main/footer.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |