diff --git a/.jscsrc b/.jscsrc index a00ec42..f0105c6 100644 --- a/.jscsrc +++ b/.jscsrc @@ -1,7 +1,8 @@ { "excludeFiles": [ "node_modules", - "examples" + "examples", + "lib/assets/bemjson.js" ], "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], "requireSpaceBeforeBlockStatements": true, diff --git a/.jshintignore b/.jshintignore index addff48..89e3b72 100644 --- a/.jshintignore +++ b/.jshintignore @@ -1,2 +1,3 @@ node_modules examples +lib/assets/bemjson.js diff --git a/README.md b/README.md index cb27dec..37c9f15 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,11 @@ module.exports = function (config) { * *String[]* `specSuffixes` — суффиксы `spec.js`-файлов БЭМ-сущностей. По умолчанию — `['spec.js']`. * *String|Function* `depsTech` — технология для раскрытия зависимостей. По умолчанию — `deps-old`. * *Boolean* `langs` — включает в сборку `i18n`. +* *String[]* `scripts` — дополнительные js-скрипты, которые необходимо подключить на тестируемую страницу. Например: +```js +scripts: ['https://yastatic.net/jquery/1.8.3/jquery.min.js', + 'https://yastatic.net/lodash/2.4.1/lodash.min.js'], +``` Запуск из консоли ----------------- diff --git a/lib/assets/bemjson.js b/lib/assets/bemjson.js index 72e9b43..20841d7 100644 --- a/lib/assets/bemjson.js +++ b/lib/assets/bemjson.js @@ -15,6 +15,12 @@ href: '<%= name %>.css', rel: 'stylesheet' } }, + <% _.forEach(scripts, function(script) { %> + { + tag: 'script', + attrs: { src: '<%= script %>' } + }, + <% }); %> { tag: 'script', attrs: { src: '<%= name %>.spec.js' } diff --git a/lib/plugin.js b/lib/plugin.js index f598b7a..bb1b11c 100644 --- a/lib/plugin.js +++ b/lib/plugin.js @@ -90,7 +90,10 @@ module.exports = function (helper) { .then(function (bemjsonAsset) { var compiled = _.template(bemjsonAsset); - bemjsonSource = compiled({ name: basename }); + bemjsonSource = compiled({ + name: basename, + scripts: options.scripts + }); return vfs.write(bemjsonFilename, bemjsonSource, 'utf-8'); });