Quantcast
Channel: Forum Pasja Informatyki - Najnowsze pytania bez odpowiedzi
Viewing all articles
Browse latest Browse all 21942

Dodanie skryptu do pliku html za pomoca gulpa

$
0
0

Witam,

Od 2 godzini próbuje dodać do mojego gulpbuilda taska który wyciągnie linijki kodu (skrypt) z danego pliku i je do innego pliku.

Udało mi się znaleźć coś takiego:
 

gulp.task('inject', function(){
  gulp.src('src/main/**/*.html') // This is the source file that will have content injected into
  .pipe(inject(gulp.src(['src/main/content/build/google-analytics.js']), { // This is the file that has the content that will be injected into index.html
    starttag: '<!-- GOOGLE_ANALYTIC -->', // Here we tell the location in which we want the injection to occur
    transform: function (filePath, file) {
      return file.contents.toString('utf8') // Return file contents as string
    }
  }))
  .pipe(gulp.dest('dist')); // This is the destination of the final product
});

// Tasks to run when gulp dist is run on the command line
gulp.task('dist', ['inject']);
<!-- GOOGLE_ANALYTIC -->
   
    <!-- endinject -->

ale dalej nie działa :l


Viewing all articles
Browse latest Browse all 21942

Trending Articles


TRX Antek AVT - 2310 ver 2,0


Автовишка HAULOTTE HA 16 SPX


POTANIACZ


Zrób Sam - rocznik 1985 [PDF] [PL]


Maxgear opinie


BMW E61 2.5d błąd 43E2 - klapa gasząca a DPF


Eveline ➤ Matowe pomadki Velvet Matt Lipstick 500, 506, 5007


Auta / Cars (2006) PLDUB.BRRip.480p.XviD.AC3-LTN / DUBBING PL


Peugeot 508 problem z elektroniką


AŚ Jelenia Góra