Skip to content

Commit b27c9ad

Browse files
committed
1.2.0
- Улучшение вывода списка файлов в настройках параметра компоента (теперь выводятся только less файлы). - Добавлена кнопка закрытия окна с ошибкой компиляции.
1 parent 079b738 commit b27c9ad

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# LESS Компилятор для Bitrix
2-
![version](https://img.shields.io/badge/version-1.1.0-brightgreen.svg?style=flat-square "Version")
2+
![version](https://img.shields.io/badge/version-1.2.0-brightgreen.svg?style=flat-square "Version")
33
![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)
44

55
Простой и удобный компонент, реализующий компиляцию LESS файлов.

install/components/pafnuty/pafnuty.less/.parameters.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
) {
1818

1919
while (false !== ($file = readdir($handle))) {
20-
if ($file != '.' && $file != '..') {
20+
if (strpos($file, '.less') !== false) {
2121
$files[$file] = $file;
2222
}
2323
}

install/components/pafnuty/pafnuty.less/class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ public function executeComponent() {
108108
$rootFolder = str_replace('\\', '/', $rootFolder);
109109

110110
/**
111-
* @todo Оптимизировать надо бы по хорошему этот момент
111+
* @todo Оптимизировать надо бы по хорошему этот момент, некрасиво, когда нельзя управлять стилями, но это в принципе не критичный момент.
112112
*/
113-
Asset::getInstance()->addString('<style>.less-error-wrapper{position:fixed;z-index:1500;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.7)}.less-error-content{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:100%}.less-error{padding:40px;color:#666;background:#fff;font:400 17px/30px Consolas,Menlo,"DejaVu Sans Mono","Courier New",monospace,serif;margin:0;word-wrap:break-word;-webkit-box-shadow:0 0 30px rgba(0,0,0,.6);box-shadow:0 0 30px rgba(0,0,0,.6)}.less-error-header{font-size:24px;font-weight:700;margin-bottom:20px;text-align:center;color:#f75b5b}.less-error-content pre{line-height:1;border:0;background-color:transparent}</style>');
113+
Asset::getInstance()->addString('<style>.less-error-wrapper{position:fixed;z-index:1500;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.7)}.less-error-content{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:100%}.less-error{padding:40px;color:#666;background:#fff;font:400 17px/30px Consolas,Menlo,"DejaVu Sans Mono","Courier New",monospace,serif;margin:0;word-wrap:break-word;-webkit-box-shadow:0 0 30px rgba(0,0,0,.6);box-shadow:0 0 30px rgba(0,0,0,.6)}.less-error-header{font-size:24px;font-weight:700;margin-bottom:20px;text-align:center;color:#f75b5b}.less-error-content pre{line-height:1;border:0;background-color:transparent}.less-error-hide{display:block;position:absolute;top:20px;right:20px;width:30px;height:30px;background:#f75b5b;color:#fff;font:400 28px/32px Arial,sans-serif;vertical-align:middle;text-align:center;border-radius:15px;cursor:pointer}.less-error-hide:hover{background:#666}</style>');
114114

115115
// Выведем текст ошибки
116-
$errorText = '<div class="less-error-wrapper"><div class="less-error-content"><div class="less-error"><div class="less-error-header">' . Loc::GetMessage('PAF_ERROR_LESS_COMPILE') . '</div><pre>' . str_replace($rootFolder, '', $file['error']) . '</pre></div></div></div>';
116+
$errorText = '<div id="less-error" class="less-error-wrapper"><div class="less-error-content"><div class="less-error"><div class="less-error-header">' . Loc::GetMessage('PAF_ERROR_LESS_COMPILE') . '</div><pre>' . str_replace($rootFolder, '', $file['error']) . '</pre> <span class="less-error-hide" onclick="lessHide(\'less-error\')" title="' . Loc::GetMessage('PAF_ERROR_LESS_COMPILE_ERROR_HIDE') . '">&times;</span></div></div></div><script>function lessHide(e){var n=document.getElementById(e);n.style.display="none"}</script>';
117117
echo $errorText;
118118
}
119119

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<?php
22
$MESS['CVP_PAFNUTY_LESS_MODULE_NOT_INSTALLED'] = 'Компонент "pafnuty.less" не установлен.';
3-
$MESS['PAF_ERROR_LESS_COMPILE'] = 'Ошибка компиляции LESS!';
3+
$MESS['PAF_ERROR_LESS_COMPILE'] = 'Ошибка компиляции LESS!';
4+
$MESS['PAF_ERROR_LESS_COMPILE_ERROR_HIDE'] = 'Скрыть';

install/version.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?
22
$arModuleVersion = array(
3-
"VERSION" => "1.1.0",
4-
"VERSION_DATE" => "2015-12-01 19:00:00",
3+
"VERSION" => "1.2.0",
4+
"VERSION_DATE" => "2015-12-02 13:22:00",
55
);
66
?>

0 commit comments

Comments
 (0)