Jump to content

File bundle


snatvb

Recommended Posts

I had some problems with module scripting in lua. I'm frond-end developer and write on javascript.
So. I thought "how I can resolve this problem?", and I remembered about webpack and gulp for front-end.
I decided, why I can't use this opportunity in mta server project. I written module for gulp witch will collect all files in one file.

And I decided publish it for community. 

https://www.npmjs.com/package/gulp-lua-import

You need nodejs.
And after you need write to console(not server, use git shell):

npm i -g gulp

You need create gulpfile.js

const gulp = require('gulp');
const luaImport = require('gulp-lua-import');

gulp.task('build', function () {
    return gulp.src('./src/*.lua')
        .pipe(luaImport())
        .pipe(gulp.dest('./mods/deathmatch/resources/'))
});

gulp.task('default', function() {
    gulp.run('build');
    gulp.watch('src/**', function(event) {
        gulp.run('build');
    });
});

After write to console:

npm init
npm i -D gulp-lua-import

After in packege.json add:

... 
"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "gulp"
  },
...

After write to console:

npm start

End. You need create folder and *.lua scripts in src, from src this fall into resource.

 

Documentation on Russian Language. If you want, I can translate it in english language.

Edited by snatvb
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...