gulp-gobin

Convert any file into managable Go source code (like go-bindata).

Usage no npm install needed!

<script type="module">
  import gulpGobin from 'https://cdn.skypack.dev/gulp-gobin';
</script>

README

gulp-gobin

Build Status

Convert any file into managable Go source code (like go-bindata).

Why Gulp Plugin

Gulp plugins works well with each other, which means you can do many things before you generate the bindata: such as minify css files, combine js files etc.

Installation

Install package with NPM and add it to your development dependencies:

npm install --save-dev gulp-gobin

Usage

var bindata = require('gulp-gobin');
var gulp = require('gulp');

gulp.task('bindata', function() {
    return gulp.src('assets/**/*', {package: 'game'})
        .pipe(bindata('bindata.go'))
        .pipe(gulp.dest('../game/bindata.go'));
});

To use the generated bindata in your golang program:

package game

import (
    "fmt"
)

func run() {
    fileContents := Assets("images/logo.png")
    fmt.Println(string(fileContents))
}

Options

  • package

    Package name for the generated bindata. Default value is "main".

TODO

  • nomemcopy
  • debug

Changelog

v0.1.0 (2014-07-01)

First release.

v0.1.1 (2014-07-02)

Fix dependency.

v0.1.2 (2014-07-02)

Remove header(avoid changing contents for each build).