Embed files into project (such as a Go executable project).
This package was inspired by the statik and the need like #56.
The package includes:
- sblocker: the cli of code generater
- sbi: the interface
- plugins: the plugin to generate code
- libs: the library to use the code block
If you use
golang - origin/zip/default
, the code generated is compatible with statik
Install the command line tool first.
go get -v -u github.com/ddosakura/sblock/sblocker
See the help
sblocker -h
-
golang
- origin - Do not use compression to shrink the files.
- zip/default
-
js
- origin
- zip/default
The plugin needs:
- Compression algorithm by golang
- The Code and Example pattern which will be generated
The library needs:
- Decompression algorithm by your language
- A FileSystem Abstraction System for you language like afero to save your files
First, you should implement the interface:
// github.com/ddosakura/sblock/sbi/interface.go
type Plugin interface {
...
}
Warning:
- If you not only have
SourceFile
andExampleFile
, you should deal theforce
flag
Then you need to provide a library to use the code generated.
Warning:
Rather than providing a library that uses sblock, I prefer to support it directly in a virtual file system.
On this point, you can track the development of aferox
- split library and plugin
- custom parameters for plugin
- the description for custom parameters
- add official nodejs/js plugin
- sblock4js
- sblock4koa
- sblock-web-driver
- custom param
no-dump
raw-name
- custom param
- print the explain to use yarn/npm
- overwrite should not delete the target folder
- the
type Plugin interface
needForceOverwrite
param
- the
- the template to develop sblock-plugin