New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

scrat-swig

Package Overview
Dependencies
Maintainers
2
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scrat-swig - npm Package Compare versions

Comparing version 0.5.3 to 0.6.0

12

CHANGELOG.md
0.6.0 / 2016-03-27
==================
* test(): 修改测试用例
* doc(README.md): 修改文档
* feat(lib/tags/require.js): $$ swig 自身编译报错,改成 `__` 前缀
* feat(lib/tags/require.js): 修改局部变量的前缀 `$_` => `$$`
* doc(README.md): 添加require局部标签的说明
* test(fixtures/require/general): 添加require标签 传入局部变量 $_ 的测试
* fix(test/lib/tags/require): fix window testcase bug
* feat(lib/tags/require.js): require标签支持以 $_ 开头传入的变量只在模块内生效
0.5.3 / 2016-01-11

@@ -3,0 +15,0 @@ ==================

5

lib/tags/require.js

@@ -15,3 +15,6 @@ 'use strict';

ctx = '{' + ctx.join(',') + '}';
return ';_output += _ext._resource.include(' + file + ',_utils.extend({},_ctx,' + ctx + '),_swig);';
// 清除掉上文 $_ 开头的变量
var clearPartParam = 'var pureCtx = {};_utils.each(_utils.keys(_ctx), function(key){ if (key.indexOf("__") !== 0) { pureCtx[key] = _ctx[key] } })';
return ';' + clearPartParam + ';_output += _ext._resource.include(' + file + ',_utils.extend({},pureCtx,' + ctx + '),_swig);';
};

@@ -18,0 +21,0 @@

2

package.json
{
"name": "scrat-swig",
"version": "0.5.3",
"version": "0.6.0",
"description": "Extensions of swig for scrat",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -40,2 +40,3 @@ # [scrat](https://github.com/scrat-team/scrat) 后端渲染解决方案的模板扩展

* $id:字符串或模板变量。要引用的组件id或相对路径
* __props:模块内的局部变量,只在当前模块上下文生效
* 示例:

@@ -50,2 +51,16 @@

```
```twig
// index.tpl
{% require $id="header" __title='tile' golbal='golbal' %}
// header.tpl
{{ __title }} // title
{{ golbal }} // golbal
{% require $id="nav" %}
// nav.tpl
{{ __title }} // null
{{ golbal }} // golbal
```

@@ -52,0 +67,0 @@ ### html

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc