Having to re-deploy static files to see changes in javascript












2















I have to run



sudo rm -rf var/*
sudo rm -rf pub/static/frontend/*
sudo bin/magento setup:static-content:deploy


to see any changes made in my js/scripts.js file. I am in developer mode.










share|improve this question























  • you mean you want to see js is changed or not ?

    – Manthan Dave
    Feb 7 '17 at 11:13











  • @ManthanDave I want to see my changes made in js files in frontend quickly and not having to clear static content and deploy it again. It takes a lot of time.

    – Rudolph
    Feb 7 '17 at 11:19











  • @Rudolph thats the standard of magento2 !!! yes you need to run this all command if you do any changes in js .

    – Manthan Dave
    Feb 7 '17 at 11:20
















2















I have to run



sudo rm -rf var/*
sudo rm -rf pub/static/frontend/*
sudo bin/magento setup:static-content:deploy


to see any changes made in my js/scripts.js file. I am in developer mode.










share|improve this question























  • you mean you want to see js is changed or not ?

    – Manthan Dave
    Feb 7 '17 at 11:13











  • @ManthanDave I want to see my changes made in js files in frontend quickly and not having to clear static content and deploy it again. It takes a lot of time.

    – Rudolph
    Feb 7 '17 at 11:19











  • @Rudolph thats the standard of magento2 !!! yes you need to run this all command if you do any changes in js .

    – Manthan Dave
    Feb 7 '17 at 11:20














2












2








2


3






I have to run



sudo rm -rf var/*
sudo rm -rf pub/static/frontend/*
sudo bin/magento setup:static-content:deploy


to see any changes made in my js/scripts.js file. I am in developer mode.










share|improve this question














I have to run



sudo rm -rf var/*
sudo rm -rf pub/static/frontend/*
sudo bin/magento setup:static-content:deploy


to see any changes made in my js/scripts.js file. I am in developer mode.







magento2 magento-2.1






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 7 '17 at 11:08









RudolphRudolph

4361917




4361917













  • you mean you want to see js is changed or not ?

    – Manthan Dave
    Feb 7 '17 at 11:13











  • @ManthanDave I want to see my changes made in js files in frontend quickly and not having to clear static content and deploy it again. It takes a lot of time.

    – Rudolph
    Feb 7 '17 at 11:19











  • @Rudolph thats the standard of magento2 !!! yes you need to run this all command if you do any changes in js .

    – Manthan Dave
    Feb 7 '17 at 11:20



















  • you mean you want to see js is changed or not ?

    – Manthan Dave
    Feb 7 '17 at 11:13











  • @ManthanDave I want to see my changes made in js files in frontend quickly and not having to clear static content and deploy it again. It takes a lot of time.

    – Rudolph
    Feb 7 '17 at 11:19











  • @Rudolph thats the standard of magento2 !!! yes you need to run this all command if you do any changes in js .

    – Manthan Dave
    Feb 7 '17 at 11:20

















you mean you want to see js is changed or not ?

– Manthan Dave
Feb 7 '17 at 11:13





you mean you want to see js is changed or not ?

– Manthan Dave
Feb 7 '17 at 11:13













@ManthanDave I want to see my changes made in js files in frontend quickly and not having to clear static content and deploy it again. It takes a lot of time.

– Rudolph
Feb 7 '17 at 11:19





@ManthanDave I want to see my changes made in js files in frontend quickly and not having to clear static content and deploy it again. It takes a lot of time.

– Rudolph
Feb 7 '17 at 11:19













@Rudolph thats the standard of magento2 !!! yes you need to run this all command if you do any changes in js .

– Manthan Dave
Feb 7 '17 at 11:20





@Rudolph thats the standard of magento2 !!! yes you need to run this all command if you do any changes in js .

– Manthan Dave
Feb 7 '17 at 11:20










2 Answers
2






active

oldest

votes


















3














When you are in developer mode, deleting the js from your static folder should be enough to regenerate it. My advice would be, just make a command line command where you quickly remove that file.



so it regenerates.
that works for CSS as well.
personally i run a gulp script that watches for changes in css file and deploys it to the specific pub directories as well. This helps me a lot with css. You can do the same for js.



Maybe you like to know what i use for css so you can apply something similar for js:



// Load gulp and plug-ins
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
less = require('gulp-less'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
gutil = require('gulp-util'),
livereload = require('gulp-livereload'),
sourcemaps = require('gulp-sourcemaps');


// Generate less to CSS.
gulp.task('less', function() {
return gulp.src(['app/design/frontend/Vendor/theme/web/css/theme.less'])
.pipe(less())
.pipe( sourcemaps.write() )
.pipe( livereload() )
.pipe(gulp.dest('pub/static/frontend/Vendor/theme/nl_NL/css'))
.pipe(gulp.dest('pub/static/frontend/Vendor/theme/de_DE/css'))
});


// Watch Files For Changes and livereload
gulp.task('watch', function() {
livereload.listen();
gulp.watch('app/design/frontend/Vendor/theme/web/css/**/*.less', ['less']);
});


gulp.task('default', ['less']);





share|improve this answer
























  • I created a gulp task for it, thanks.

    – Rudolph
    Feb 7 '17 at 12:17











  • Great, i love gulp, war better then grunt ;-)

    – Kay Int Veen
    Feb 7 '17 at 18:46











  • @Rudolph is there any chance you could please post an answer of your solution? I'm having a rough time fighting with files and trying to understand gulp. Thanks

    – Chris K
    Feb 2 '18 at 4:40



















1














You can write your code in static files,



pub/static/frontend/manento/theme/en_us/yourmodel/js/yourjs


You can change directory here and check change on the frontend , after all, work done then copy your code in the main file ( in your custom module or js) after that deploy content.






share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "479"
    };
    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: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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%2fmagento.stackexchange.com%2fquestions%2f158532%2fhaving-to-re-deploy-static-files-to-see-changes-in-javascript%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    When you are in developer mode, deleting the js from your static folder should be enough to regenerate it. My advice would be, just make a command line command where you quickly remove that file.



    so it regenerates.
    that works for CSS as well.
    personally i run a gulp script that watches for changes in css file and deploys it to the specific pub directories as well. This helps me a lot with css. You can do the same for js.



    Maybe you like to know what i use for css so you can apply something similar for js:



    // Load gulp and plug-ins
    var gulp = require('gulp'),
    jshint = require('gulp-jshint'),
    less = require('gulp-less'),
    concat = require('gulp-concat'),
    uglify = require('gulp-uglify'),
    rename = require('gulp-rename'),
    gutil = require('gulp-util'),
    livereload = require('gulp-livereload'),
    sourcemaps = require('gulp-sourcemaps');


    // Generate less to CSS.
    gulp.task('less', function() {
    return gulp.src(['app/design/frontend/Vendor/theme/web/css/theme.less'])
    .pipe(less())
    .pipe( sourcemaps.write() )
    .pipe( livereload() )
    .pipe(gulp.dest('pub/static/frontend/Vendor/theme/nl_NL/css'))
    .pipe(gulp.dest('pub/static/frontend/Vendor/theme/de_DE/css'))
    });


    // Watch Files For Changes and livereload
    gulp.task('watch', function() {
    livereload.listen();
    gulp.watch('app/design/frontend/Vendor/theme/web/css/**/*.less', ['less']);
    });


    gulp.task('default', ['less']);





    share|improve this answer
























    • I created a gulp task for it, thanks.

      – Rudolph
      Feb 7 '17 at 12:17











    • Great, i love gulp, war better then grunt ;-)

      – Kay Int Veen
      Feb 7 '17 at 18:46











    • @Rudolph is there any chance you could please post an answer of your solution? I'm having a rough time fighting with files and trying to understand gulp. Thanks

      – Chris K
      Feb 2 '18 at 4:40
















    3














    When you are in developer mode, deleting the js from your static folder should be enough to regenerate it. My advice would be, just make a command line command where you quickly remove that file.



    so it regenerates.
    that works for CSS as well.
    personally i run a gulp script that watches for changes in css file and deploys it to the specific pub directories as well. This helps me a lot with css. You can do the same for js.



    Maybe you like to know what i use for css so you can apply something similar for js:



    // Load gulp and plug-ins
    var gulp = require('gulp'),
    jshint = require('gulp-jshint'),
    less = require('gulp-less'),
    concat = require('gulp-concat'),
    uglify = require('gulp-uglify'),
    rename = require('gulp-rename'),
    gutil = require('gulp-util'),
    livereload = require('gulp-livereload'),
    sourcemaps = require('gulp-sourcemaps');


    // Generate less to CSS.
    gulp.task('less', function() {
    return gulp.src(['app/design/frontend/Vendor/theme/web/css/theme.less'])
    .pipe(less())
    .pipe( sourcemaps.write() )
    .pipe( livereload() )
    .pipe(gulp.dest('pub/static/frontend/Vendor/theme/nl_NL/css'))
    .pipe(gulp.dest('pub/static/frontend/Vendor/theme/de_DE/css'))
    });


    // Watch Files For Changes and livereload
    gulp.task('watch', function() {
    livereload.listen();
    gulp.watch('app/design/frontend/Vendor/theme/web/css/**/*.less', ['less']);
    });


    gulp.task('default', ['less']);





    share|improve this answer
























    • I created a gulp task for it, thanks.

      – Rudolph
      Feb 7 '17 at 12:17











    • Great, i love gulp, war better then grunt ;-)

      – Kay Int Veen
      Feb 7 '17 at 18:46











    • @Rudolph is there any chance you could please post an answer of your solution? I'm having a rough time fighting with files and trying to understand gulp. Thanks

      – Chris K
      Feb 2 '18 at 4:40














    3












    3








    3







    When you are in developer mode, deleting the js from your static folder should be enough to regenerate it. My advice would be, just make a command line command where you quickly remove that file.



    so it regenerates.
    that works for CSS as well.
    personally i run a gulp script that watches for changes in css file and deploys it to the specific pub directories as well. This helps me a lot with css. You can do the same for js.



    Maybe you like to know what i use for css so you can apply something similar for js:



    // Load gulp and plug-ins
    var gulp = require('gulp'),
    jshint = require('gulp-jshint'),
    less = require('gulp-less'),
    concat = require('gulp-concat'),
    uglify = require('gulp-uglify'),
    rename = require('gulp-rename'),
    gutil = require('gulp-util'),
    livereload = require('gulp-livereload'),
    sourcemaps = require('gulp-sourcemaps');


    // Generate less to CSS.
    gulp.task('less', function() {
    return gulp.src(['app/design/frontend/Vendor/theme/web/css/theme.less'])
    .pipe(less())
    .pipe( sourcemaps.write() )
    .pipe( livereload() )
    .pipe(gulp.dest('pub/static/frontend/Vendor/theme/nl_NL/css'))
    .pipe(gulp.dest('pub/static/frontend/Vendor/theme/de_DE/css'))
    });


    // Watch Files For Changes and livereload
    gulp.task('watch', function() {
    livereload.listen();
    gulp.watch('app/design/frontend/Vendor/theme/web/css/**/*.less', ['less']);
    });


    gulp.task('default', ['less']);





    share|improve this answer













    When you are in developer mode, deleting the js from your static folder should be enough to regenerate it. My advice would be, just make a command line command where you quickly remove that file.



    so it regenerates.
    that works for CSS as well.
    personally i run a gulp script that watches for changes in css file and deploys it to the specific pub directories as well. This helps me a lot with css. You can do the same for js.



    Maybe you like to know what i use for css so you can apply something similar for js:



    // Load gulp and plug-ins
    var gulp = require('gulp'),
    jshint = require('gulp-jshint'),
    less = require('gulp-less'),
    concat = require('gulp-concat'),
    uglify = require('gulp-uglify'),
    rename = require('gulp-rename'),
    gutil = require('gulp-util'),
    livereload = require('gulp-livereload'),
    sourcemaps = require('gulp-sourcemaps');


    // Generate less to CSS.
    gulp.task('less', function() {
    return gulp.src(['app/design/frontend/Vendor/theme/web/css/theme.less'])
    .pipe(less())
    .pipe( sourcemaps.write() )
    .pipe( livereload() )
    .pipe(gulp.dest('pub/static/frontend/Vendor/theme/nl_NL/css'))
    .pipe(gulp.dest('pub/static/frontend/Vendor/theme/de_DE/css'))
    });


    // Watch Files For Changes and livereload
    gulp.task('watch', function() {
    livereload.listen();
    gulp.watch('app/design/frontend/Vendor/theme/web/css/**/*.less', ['less']);
    });


    gulp.task('default', ['less']);






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Feb 7 '17 at 11:14









    Kay Int VeenKay Int Veen

    1,0531923




    1,0531923













    • I created a gulp task for it, thanks.

      – Rudolph
      Feb 7 '17 at 12:17











    • Great, i love gulp, war better then grunt ;-)

      – Kay Int Veen
      Feb 7 '17 at 18:46











    • @Rudolph is there any chance you could please post an answer of your solution? I'm having a rough time fighting with files and trying to understand gulp. Thanks

      – Chris K
      Feb 2 '18 at 4:40



















    • I created a gulp task for it, thanks.

      – Rudolph
      Feb 7 '17 at 12:17











    • Great, i love gulp, war better then grunt ;-)

      – Kay Int Veen
      Feb 7 '17 at 18:46











    • @Rudolph is there any chance you could please post an answer of your solution? I'm having a rough time fighting with files and trying to understand gulp. Thanks

      – Chris K
      Feb 2 '18 at 4:40

















    I created a gulp task for it, thanks.

    – Rudolph
    Feb 7 '17 at 12:17





    I created a gulp task for it, thanks.

    – Rudolph
    Feb 7 '17 at 12:17













    Great, i love gulp, war better then grunt ;-)

    – Kay Int Veen
    Feb 7 '17 at 18:46





    Great, i love gulp, war better then grunt ;-)

    – Kay Int Veen
    Feb 7 '17 at 18:46













    @Rudolph is there any chance you could please post an answer of your solution? I'm having a rough time fighting with files and trying to understand gulp. Thanks

    – Chris K
    Feb 2 '18 at 4:40





    @Rudolph is there any chance you could please post an answer of your solution? I'm having a rough time fighting with files and trying to understand gulp. Thanks

    – Chris K
    Feb 2 '18 at 4:40













    1














    You can write your code in static files,



    pub/static/frontend/manento/theme/en_us/yourmodel/js/yourjs


    You can change directory here and check change on the frontend , after all, work done then copy your code in the main file ( in your custom module or js) after that deploy content.






    share|improve this answer






























      1














      You can write your code in static files,



      pub/static/frontend/manento/theme/en_us/yourmodel/js/yourjs


      You can change directory here and check change on the frontend , after all, work done then copy your code in the main file ( in your custom module or js) after that deploy content.






      share|improve this answer




























        1












        1








        1







        You can write your code in static files,



        pub/static/frontend/manento/theme/en_us/yourmodel/js/yourjs


        You can change directory here and check change on the frontend , after all, work done then copy your code in the main file ( in your custom module or js) after that deploy content.






        share|improve this answer















        You can write your code in static files,



        pub/static/frontend/manento/theme/en_us/yourmodel/js/yourjs


        You can change directory here and check change on the frontend , after all, work done then copy your code in the main file ( in your custom module or js) after that deploy content.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 2 mins ago









        Teja Bhagavan Kollepara

        2,94841847




        2,94841847










        answered Feb 7 '17 at 16:43









        Surendra Kumar AhirSurendra Kumar Ahir

        853717




        853717






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Magento Stack Exchange!


            • 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%2fmagento.stackexchange.com%2fquestions%2f158532%2fhaving-to-re-deploy-static-files-to-see-changes-in-javascript%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

            Magento 2 controller redirect on button click in phtml file

            Polycentropodidae