0

I want to lock the files that are being compiled with gulp.

So basically if i have app.js, which is generated from a compilation of different .js files, how do i prevent people from writing code inside app.js ?

my simple gulp config is something like this :

elixir(function (mix) {
    mix.less('app.less');
    mix.scripts([
        "main.js",
        "utilities.js",
        "searchbox.js",
        "cart.js",
        "merchant-login.js",
        "customer-login.js",
        "subscribe.js",
        "validators.js"
    ], "public/js/app.js");
});

p.s: Im using elixir.

Gazler
  • 83,029
  • 18
  • 279
  • 245
Abd Rmdn
  • 480
  • 4
  • 11

1 Answers1

0

Gulp does task running. What you can do with files produced by some gulp tasks is out of Gulp control.

Probably you don't need to prevent from doing physical modification to app.js (by "locking" it or applying strict security restriction). I guess that the solution your are trying to solve is - if a developer makes accidental changes to app.js it does not affect other developers or the production. How to solve this depends on your development workflow.

If you use some kind of Version Control (e.g., Git), first you need to remove the app.js and other files produced by the build from VC. It means if anyone modifies app.js it will be only local change for this developer and other developers will not get this modifications when pulling from VC.

Next, you need to create a deploy process, that takes sources, builds them and produces a deployment package or a folder that will be put it to the production environment (hosting).

You need to minimize access to the production, and prohibit (by agreement) that none is allowed to make changes in it but by running the build-deploy process.

Sergey L
  • 1,402
  • 1
  • 9
  • 11