1.0.6 • Published 7 years ago

spm-loader v1.0.6

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Note: based on alibaba aplus data framework, only support aplus traceless goldlog, and is strongly dependent on React !!

npm npmdown builds cover

npm install --save-dev spm-loader

Configuration (use it combined with babel-loader)

module.exports = {
	module: {
    	rules: [{
        	test: /.\jsx?$/,
            use: [
            	'babel-loader',
                'spm-loader?goldlog=/aliyun&context=spm_self&key=spmKey'
            ]
        }]
    }
}

Use in module

The loader just replace the attribute spm-auto-click to standard traceless goldlog, for example data-spm-click="gostr=/aliyun;locaid=d1".

To verify locaid is unique, we compose it using three components, the filename, the module key and the iteration sequence.

So, our final locaid would be locaid=d{filename}{key}{seq}. See more in our examples.

<div spm-auto-click /> // => <div data-spm-click="gostr=/aliyun;locaid=d{filename}{key||''}" />
<div spm-auto-click={1}> // => <div data-spm-click="gostr=/aliyun;locaid=d{filename}{key||''}1" />

Options

goldlog

Traceless goldlog key. You should apply it in the spm center, start with /, default is /aliyun.

context

In jsx, we use context as the context of any iteration, so we can get properties in iteration, default is spm_self.

key

A module can be used many times in a parent module, but the traceless goldlog key must be unique, so key is used to identity a module, default is spmKey.

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago