Javascript is not running in the externall file

52 views Asked by At

I am using GULP and everything works fine on the first page. I linked another project_1.html page to it but for some reasons its JavaScript is not working. External html file recognizes Sass except for new linked scrit2.js file. Any idea what may cause it? Here is Gulpfile

var gulp = require('gulp'),
gutil = require('gulp-util'), 
concat = require('gulp-concat'), 
compass = require('gulp-compass'), 
connect = require('gulp-connect');  


var jsSources = [
'1_components/scripts/*.js'
];

var sassSources = [
    '1_components/sass/*.scss'
];

var htmlSources = [
    '2_builds/development/*html'
];
gulp.task('js', function(){
    gulp.src(jsSources)
    .pipe(concat('script.js'))
    .pipe(gulp.dest('2_builds/development/js'))
    .pipe(connect.reload())
});

in the second HTML I included

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>  

The same what I have on the main page

Here is an image of my workflow http://s8.postimg.org/dytbyze4l/111.png

1

There are 1 answers

4
Rico Herwig On

Your problem is not clear to me.

Your index.html includes the script.js from development/js/. Your project_1.html includes the script2.js? Is that correct?

If so, ensure that script2.js is inside your development/js/ folder. I only see the script.js being created inside your gulp script. Is your script2.js really being deployed into your build folder?