Gulp build fails










0















I am trying to add gulp build tool for my project, which uses angularjs. When I run gulp build tool following error thrown



Error---Error in plugin 'gulp-uglify'



F:testcode - Copytesttesttest.template.html: SyntaxError: Unexpected token: operator (<)



Details:
fileName: F:testcode - Copytesttesttest.template.html
lineNumber: 1



events.js:160
throw er; // Unhandled 'error' event
^



Here is my gulpfile.js file



 'use strict'
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserSync = require('browser-sync'),
fs = require('fs'),
del = require('del'),
uglify = require('gulp-uglify'),
usemin = require('gulp-usemin'),
rev = require('gulp-rev'),
htmlmin = require('gulp-htmlmin'),
cleanCss = require('gulp-clean-css');

gulp.task('clean',function ()
return del(['dist'])
);


gulp.task('sass',function()
return gulp.src('./css/*.scss')
.pipe(sass().on('error',sass.logError))
.pipe(gulp.dest('./css'));
);

gulp.task('sass:watch',function()
gulp.watch('./css/*.scss',['sass'])
);


gulp.task('browser-sync',function()
var files = [
'./*.html',
'./static/css/**/*.css',
'./static/images/**/*.png,jpg,gif',
'./static/js/**/*.js'
];

browserSync.init(files,
server:
baseDir:"./"

);
);

gulp.task('usemin', function()
return gulp.src('./static/js/**/*.html')
.pipe(usemin(
css: [ rev() ],
html: [ htmlmin( collapseWhitespace: true ) ],
js: [ uglify(), rev() ],
inlinejs: [ uglify() ],
inlinecss: [ cleanCss(), 'concat' ]
))
.pipe(uglify().on('error', function(e)
console.log("Error---"+e);
))
.pipe(gulp.dest('build/'));
);

gulp.task('default',['browser-sync'],function()
gulp.start('sass:watch');
)

gulp.task('build',['clean'],function ()
gulp.start('usemin')
)









share|improve this question


























    0















    I am trying to add gulp build tool for my project, which uses angularjs. When I run gulp build tool following error thrown



    Error---Error in plugin 'gulp-uglify'



    F:testcode - Copytesttesttest.template.html: SyntaxError: Unexpected token: operator (<)



    Details:
    fileName: F:testcode - Copytesttesttest.template.html
    lineNumber: 1



    events.js:160
    throw er; // Unhandled 'error' event
    ^



    Here is my gulpfile.js file



     'use strict'
    var gulp = require('gulp'),
    sass = require('gulp-sass'),
    browserSync = require('browser-sync'),
    fs = require('fs'),
    del = require('del'),
    uglify = require('gulp-uglify'),
    usemin = require('gulp-usemin'),
    rev = require('gulp-rev'),
    htmlmin = require('gulp-htmlmin'),
    cleanCss = require('gulp-clean-css');

    gulp.task('clean',function ()
    return del(['dist'])
    );


    gulp.task('sass',function()
    return gulp.src('./css/*.scss')
    .pipe(sass().on('error',sass.logError))
    .pipe(gulp.dest('./css'));
    );

    gulp.task('sass:watch',function()
    gulp.watch('./css/*.scss',['sass'])
    );


    gulp.task('browser-sync',function()
    var files = [
    './*.html',
    './static/css/**/*.css',
    './static/images/**/*.png,jpg,gif',
    './static/js/**/*.js'
    ];

    browserSync.init(files,
    server:
    baseDir:"./"

    );
    );

    gulp.task('usemin', function()
    return gulp.src('./static/js/**/*.html')
    .pipe(usemin(
    css: [ rev() ],
    html: [ htmlmin( collapseWhitespace: true ) ],
    js: [ uglify(), rev() ],
    inlinejs: [ uglify() ],
    inlinecss: [ cleanCss(), 'concat' ]
    ))
    .pipe(uglify().on('error', function(e)
    console.log("Error---"+e);
    ))
    .pipe(gulp.dest('build/'));
    );

    gulp.task('default',['browser-sync'],function()
    gulp.start('sass:watch');
    )

    gulp.task('build',['clean'],function ()
    gulp.start('usemin')
    )









    share|improve this question
























      0












      0








      0








      I am trying to add gulp build tool for my project, which uses angularjs. When I run gulp build tool following error thrown



      Error---Error in plugin 'gulp-uglify'



      F:testcode - Copytesttesttest.template.html: SyntaxError: Unexpected token: operator (<)



      Details:
      fileName: F:testcode - Copytesttesttest.template.html
      lineNumber: 1



      events.js:160
      throw er; // Unhandled 'error' event
      ^



      Here is my gulpfile.js file



       'use strict'
      var gulp = require('gulp'),
      sass = require('gulp-sass'),
      browserSync = require('browser-sync'),
      fs = require('fs'),
      del = require('del'),
      uglify = require('gulp-uglify'),
      usemin = require('gulp-usemin'),
      rev = require('gulp-rev'),
      htmlmin = require('gulp-htmlmin'),
      cleanCss = require('gulp-clean-css');

      gulp.task('clean',function ()
      return del(['dist'])
      );


      gulp.task('sass',function()
      return gulp.src('./css/*.scss')
      .pipe(sass().on('error',sass.logError))
      .pipe(gulp.dest('./css'));
      );

      gulp.task('sass:watch',function()
      gulp.watch('./css/*.scss',['sass'])
      );


      gulp.task('browser-sync',function()
      var files = [
      './*.html',
      './static/css/**/*.css',
      './static/images/**/*.png,jpg,gif',
      './static/js/**/*.js'
      ];

      browserSync.init(files,
      server:
      baseDir:"./"

      );
      );

      gulp.task('usemin', function()
      return gulp.src('./static/js/**/*.html')
      .pipe(usemin(
      css: [ rev() ],
      html: [ htmlmin( collapseWhitespace: true ) ],
      js: [ uglify(), rev() ],
      inlinejs: [ uglify() ],
      inlinecss: [ cleanCss(), 'concat' ]
      ))
      .pipe(uglify().on('error', function(e)
      console.log("Error---"+e);
      ))
      .pipe(gulp.dest('build/'));
      );

      gulp.task('default',['browser-sync'],function()
      gulp.start('sass:watch');
      )

      gulp.task('build',['clean'],function ()
      gulp.start('usemin')
      )









      share|improve this question














      I am trying to add gulp build tool for my project, which uses angularjs. When I run gulp build tool following error thrown



      Error---Error in plugin 'gulp-uglify'



      F:testcode - Copytesttesttest.template.html: SyntaxError: Unexpected token: operator (<)



      Details:
      fileName: F:testcode - Copytesttesttest.template.html
      lineNumber: 1



      events.js:160
      throw er; // Unhandled 'error' event
      ^



      Here is my gulpfile.js file



       'use strict'
      var gulp = require('gulp'),
      sass = require('gulp-sass'),
      browserSync = require('browser-sync'),
      fs = require('fs'),
      del = require('del'),
      uglify = require('gulp-uglify'),
      usemin = require('gulp-usemin'),
      rev = require('gulp-rev'),
      htmlmin = require('gulp-htmlmin'),
      cleanCss = require('gulp-clean-css');

      gulp.task('clean',function ()
      return del(['dist'])
      );


      gulp.task('sass',function()
      return gulp.src('./css/*.scss')
      .pipe(sass().on('error',sass.logError))
      .pipe(gulp.dest('./css'));
      );

      gulp.task('sass:watch',function()
      gulp.watch('./css/*.scss',['sass'])
      );


      gulp.task('browser-sync',function()
      var files = [
      './*.html',
      './static/css/**/*.css',
      './static/images/**/*.png,jpg,gif',
      './static/js/**/*.js'
      ];

      browserSync.init(files,
      server:
      baseDir:"./"

      );
      );

      gulp.task('usemin', function()
      return gulp.src('./static/js/**/*.html')
      .pipe(usemin(
      css: [ rev() ],
      html: [ htmlmin( collapseWhitespace: true ) ],
      js: [ uglify(), rev() ],
      inlinejs: [ uglify() ],
      inlinecss: [ cleanCss(), 'concat' ]
      ))
      .pipe(uglify().on('error', function(e)
      console.log("Error---"+e);
      ))
      .pipe(gulp.dest('build/'));
      );

      gulp.task('default',['browser-sync'],function()
      gulp.start('sass:watch');
      )

      gulp.task('build',['clean'],function ()
      gulp.start('usemin')
      )






      gulp gulp-uglify






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 24 '17 at 15:17









      niranniran

      93772141




      93772141






















          1 Answer
          1






          active

          oldest

          votes


















          -1














          Follow the below steps :
          1) Install Nodejs 6.9.3
          2) Install gulp using "npm install -g gulp"
          3) create gulp file "gulpfile.js" in your project directory.
          4) Add the below code snippet :
          a) Below task will concat(merge) all the included js file in ".SRC" into one file



           

          var concat = require("gulp-concat"),
          var uglify = require('gulp-uglify'),

          gulp.task("js", function()
          return gulp
          .src([
          "./dev/libs/angular/angular.1.4.5.min.js",
          "./dev/libs/angular/angular-animate.1.4.5.min.js"
          ])
          .pipe(concat("scripts.js"))
          .pipe(hash(
          "format": "name_size.js"
          ))
          .pipe(gulp.dest("PATH_FOR_BUILD"));
          );






          b) Below task will minify the concated file by removing spaces and comments to make the file in the compressed form :



           

          gulp.task('uglify', function()
          return gulp.src("PATH_FOR_BUILD")
          .pipe(uglify( mangle: false ))
          .pipe(gulp.dest("PATH_FOR_BUILD"));
          );





          Please check the below link for more details on deployment and build system:

          https://www.tutespace.com/2018/11/angular-js-build-deploy-using-gulp.html





          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47476086%2fgulp-build-fails%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            -1














            Follow the below steps :
            1) Install Nodejs 6.9.3
            2) Install gulp using "npm install -g gulp"
            3) create gulp file "gulpfile.js" in your project directory.
            4) Add the below code snippet :
            a) Below task will concat(merge) all the included js file in ".SRC" into one file



             

            var concat = require("gulp-concat"),
            var uglify = require('gulp-uglify'),

            gulp.task("js", function()
            return gulp
            .src([
            "./dev/libs/angular/angular.1.4.5.min.js",
            "./dev/libs/angular/angular-animate.1.4.5.min.js"
            ])
            .pipe(concat("scripts.js"))
            .pipe(hash(
            "format": "name_size.js"
            ))
            .pipe(gulp.dest("PATH_FOR_BUILD"));
            );






            b) Below task will minify the concated file by removing spaces and comments to make the file in the compressed form :



             

            gulp.task('uglify', function()
            return gulp.src("PATH_FOR_BUILD")
            .pipe(uglify( mangle: false ))
            .pipe(gulp.dest("PATH_FOR_BUILD"));
            );





            Please check the below link for more details on deployment and build system:

            https://www.tutespace.com/2018/11/angular-js-build-deploy-using-gulp.html





            share|improve this answer





























              -1














              Follow the below steps :
              1) Install Nodejs 6.9.3
              2) Install gulp using "npm install -g gulp"
              3) create gulp file "gulpfile.js" in your project directory.
              4) Add the below code snippet :
              a) Below task will concat(merge) all the included js file in ".SRC" into one file



               

              var concat = require("gulp-concat"),
              var uglify = require('gulp-uglify'),

              gulp.task("js", function()
              return gulp
              .src([
              "./dev/libs/angular/angular.1.4.5.min.js",
              "./dev/libs/angular/angular-animate.1.4.5.min.js"
              ])
              .pipe(concat("scripts.js"))
              .pipe(hash(
              "format": "name_size.js"
              ))
              .pipe(gulp.dest("PATH_FOR_BUILD"));
              );






              b) Below task will minify the concated file by removing spaces and comments to make the file in the compressed form :



               

              gulp.task('uglify', function()
              return gulp.src("PATH_FOR_BUILD")
              .pipe(uglify( mangle: false ))
              .pipe(gulp.dest("PATH_FOR_BUILD"));
              );





              Please check the below link for more details on deployment and build system:

              https://www.tutespace.com/2018/11/angular-js-build-deploy-using-gulp.html





              share|improve this answer



























                -1












                -1








                -1







                Follow the below steps :
                1) Install Nodejs 6.9.3
                2) Install gulp using "npm install -g gulp"
                3) create gulp file "gulpfile.js" in your project directory.
                4) Add the below code snippet :
                a) Below task will concat(merge) all the included js file in ".SRC" into one file



                 

                var concat = require("gulp-concat"),
                var uglify = require('gulp-uglify'),

                gulp.task("js", function()
                return gulp
                .src([
                "./dev/libs/angular/angular.1.4.5.min.js",
                "./dev/libs/angular/angular-animate.1.4.5.min.js"
                ])
                .pipe(concat("scripts.js"))
                .pipe(hash(
                "format": "name_size.js"
                ))
                .pipe(gulp.dest("PATH_FOR_BUILD"));
                );






                b) Below task will minify the concated file by removing spaces and comments to make the file in the compressed form :



                 

                gulp.task('uglify', function()
                return gulp.src("PATH_FOR_BUILD")
                .pipe(uglify( mangle: false ))
                .pipe(gulp.dest("PATH_FOR_BUILD"));
                );





                Please check the below link for more details on deployment and build system:

                https://www.tutespace.com/2018/11/angular-js-build-deploy-using-gulp.html





                share|improve this answer















                Follow the below steps :
                1) Install Nodejs 6.9.3
                2) Install gulp using "npm install -g gulp"
                3) create gulp file "gulpfile.js" in your project directory.
                4) Add the below code snippet :
                a) Below task will concat(merge) all the included js file in ".SRC" into one file



                 

                var concat = require("gulp-concat"),
                var uglify = require('gulp-uglify'),

                gulp.task("js", function()
                return gulp
                .src([
                "./dev/libs/angular/angular.1.4.5.min.js",
                "./dev/libs/angular/angular-animate.1.4.5.min.js"
                ])
                .pipe(concat("scripts.js"))
                .pipe(hash(
                "format": "name_size.js"
                ))
                .pipe(gulp.dest("PATH_FOR_BUILD"));
                );






                b) Below task will minify the concated file by removing spaces and comments to make the file in the compressed form :



                 

                gulp.task('uglify', function()
                return gulp.src("PATH_FOR_BUILD")
                .pipe(uglify( mangle: false ))
                .pipe(gulp.dest("PATH_FOR_BUILD"));
                );





                Please check the below link for more details on deployment and build system:

                https://www.tutespace.com/2018/11/angular-js-build-deploy-using-gulp.html





                 

                var concat = require("gulp-concat"),
                var uglify = require('gulp-uglify'),

                gulp.task("js", function()
                return gulp
                .src([
                "./dev/libs/angular/angular.1.4.5.min.js",
                "./dev/libs/angular/angular-animate.1.4.5.min.js"
                ])
                .pipe(concat("scripts.js"))
                .pipe(hash(
                "format": "name_size.js"
                ))
                .pipe(gulp.dest("PATH_FOR_BUILD"));
                );





                 

                var concat = require("gulp-concat"),
                var uglify = require('gulp-uglify'),

                gulp.task("js", function()
                return gulp
                .src([
                "./dev/libs/angular/angular.1.4.5.min.js",
                "./dev/libs/angular/angular-animate.1.4.5.min.js"
                ])
                .pipe(concat("scripts.js"))
                .pipe(hash(
                "format": "name_size.js"
                ))
                .pipe(gulp.dest("PATH_FOR_BUILD"));
                );





                 

                gulp.task('uglify', function()
                return gulp.src("PATH_FOR_BUILD")
                .pipe(uglify( mangle: false ))
                .pipe(gulp.dest("PATH_FOR_BUILD"));
                );





                 

                gulp.task('uglify', function()
                return gulp.src("PATH_FOR_BUILD")
                .pipe(uglify( mangle: false ))
                .pipe(gulp.dest("PATH_FOR_BUILD"));
                );






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 15 '18 at 16:34

























                answered Nov 15 '18 at 5:21









                Shrinivas KalangutkarShrinivas Kalangutkar

                47548




                47548





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47476086%2fgulp-build-fails%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

                    Syphilis

                    Darth Vader #20