bem-archive / bem-tools

Toolkit to work with files based on BEM methodology
http://bem.info/tools/bem/
MIT License
395 stars 72 forks source link

Оператор || в .bemhtml #187

Closed dmage closed 12 years ago

dmage commented 12 years ago

Следующая строчка в .bemhtml

block b-chart, elem axis {
    (this.elemMods.pos == 'left' || this.elemMods.pos == 'right'), !this.ctx._wrap, default: {

компилируется в

if (!(this.block === "b-chart" && this.elem === "axis" && this.elemMods.pos == "left" || this.elemMods.pos == "right" && !this.ctx._wrap && this._mode === "default") === false) {

Возможно использовать || не совсем правильно, но тихо опускать скобки тут нельзя, лучше просто упасть на ||.

$ ./node_modules/.bin/bem --version
0.5.10
indutny commented 12 years ago

Обнови ometajs, пожалуйста. В текущей версии должно работать (даже без скобок).

dmage commented 12 years ago

Да, во время сборки оно ругается на ometajs, похоже не нужно было ставить ometajs рядом. Теперь не понятно что обновлять. :)

23:36:01.196 - info: [t] Build time for "pages/simple-chart/_simple-chart.js" [1]: 779ms
!!!
!!! Warning: you're using grammar compiled with previous version of ometajs. Please recompile it with the newest one
!!!

23:36:03.570 - info: [t] Build time for "pages/simple-chart/simple-chart.bemhtml.js" [1]: 5265ms

Вот список установленных пакетов (локально, так оно вызывается в GNUmakefile из bem-bl-test):

$ npm list
/home/dmage/tmp/b-chart
├─┬ bem@0.5.10 
│ ├── apw@0.3.4 
│ ├─┬ borschik@0.0.10 
│ │ └─┬ cssp@1.0.6 
│ │   └── ometajs@3.1.11 
│ ├─┬ coa@0.3.5 
│ │ └─┬ q@0.7.2 
│ │   └── event-queue@0.2.0 
│ ├── csso@1.2.15 
│ ├── inherit@1.0.4 
│ ├── memorystream@0.2.0 
│ ├── mime@1.2.7 
│ ├─┬ ometajs@2.1.10 
│ │ ├─┬ q@0.7.2 
│ │ │ └── event-queue@0.2.0 
│ │ └── uglify-js@1.1.1 
│ ├── q@0.8.5 
│ ├─┬ q-fs@0.1.29 
│ │ ├── fs-boot@0.0.8 
│ │ └─┬ q-io@0.0.13 
│ │   └── q@0.8.4 
│ ├─┬ q-http@0.1.14 
│ │ ├── q@0.8.4 
│ │ └── q-io@0.0.13 
│ ├─┬ qq@0.3.5 
│ │ └── q@0.8.4 
│ ├── uglify-js@1.3.2 
│ ├── underscore@1.3.3 
│ ├─┬ winston@0.6.2 
│ │ ├── async@0.1.22 
│ │ ├── colors@0.6.0-1 
│ │ ├── cycle@1.0.0 
│ │ ├── eyes@0.1.7 
│ │ ├── pkginfo@0.2.3 
│ │ ├── request@2.9.203 
│ │ └── stack-trace@0.0.6 
│ └─┬ xjst@0.2.21 
│   ├── coa@0.3.1 
│   ├─┬ q@0.7.2 
│   │ └── event-queue@0.2.0 
│   └── uglify-js@1.1.1 
├─┬ ometajs@3.1.11 
│ ├─┬ coa@0.3.5 
│ │ └─┬ q@0.7.2 
│ │   └── event-queue@0.2.0 
│ ├── q@0.8.5 
│ └── uglify-js@1.3.2 
└─┬ xjst@0.3.3 
  ├── coa@0.3.1 
  ├── ometajs@3.1.11 
  ├── q@0.8.5 
  └── uglify-js@1.3.2 
indutny commented 12 years ago

npm install ometajs@2.1.x и npm install xjst@0.2.x должен помочь.

dmage commented 12 years ago

npm install ometajs@2.1.x и npm install xjst@0.2.21 помогли, этот момент скомпилировался правильно. Спасибо.

С другой версией xjst была ошибка:

00:01:48.851 - info: [t] isValid() time for "pages/simple-chart/_simple-chart.js" [1]: 12ms
error: TypeError: object is not a function
00:01:49.606 - info: [t] Build time for "pages/simple-chart/simple-chart.bemhtml.js" [1]: 830ms
00:01:49.607 - info: [t] Build total: 1694ms
TypeError: object is not a function
    at Function.matchAll (/home/dmage/tmp/b-chart/node_modules/xjst/node_modules/ometajs/lib/ometajs/core/grammar.js:42:14)
    at [object Object].bemBuild (/home/dmage/tmp/b-chart/bem-bl/blocks-common/i-bem/bem/techs/bemhtml.js:24:42)
    at /home/dmage/tmp/b-chart/node_modules/bem/lib/tech.js:646:38
    at _fulfilled (/home/dmage/tmp/b-chart/node_modules/bem/node_modules/qq/node_modules/q/q.js:551:32)
    at makePromise.promiseSend (/home/dmage/tmp/b-chart/node_modules/bem/node_modules/qq/node_modules/q/q.js:271:38)
    at /home/dmage/tmp/b-chart/node_modules/bem/node_modules/qq/node_modules/q/q.js:573:18
    at makePromise.promiseSend (/home/dmage/tmp/b-chart/node_modules/bem/node_modules/qq/node_modules/q/q.js:271:38)
    at Array.<anonymous> (/home/dmage/tmp/b-chart/node_modules/bem/node_modules/qq/node_modules/q/q.js:195:35)
    at EventEmitter._tickCallback (node.js:190:39)