Giter VIP home page Giter VIP logo

gulp-htmlbuild's People

Contributors

brandly avatar janpot avatar javoire avatar jonsamwell avatar layoric avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gulp-htmlbuild's Issues

Difference from gulp-usemin

I see in description that it is inspired by grunt-usemin... What are differences between this plugin and gulp-usemin? Does it add anything different?

JS files with query strings ignored

The following is left out of the build:

<script src="vendor/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

But the following isn't:

<script src="vendor/mathjax/MathJax.js"></script>

I'll try to make a minimized test-case later

Absolute paths

Just a heads up: It won't build the js or css files if the paths in the html start with /. Is a silent error.

Respect comments?

Is it possible to respect comments?
Example:

<!-- htmlbuild:js -->
<!-- inject:js -->
<script src="/js-dev/default.js"></script>
<script src="/js-dev/test.js"></script>
<!-- endinject -->
<!-- endbuild  -->

Convert to:

<script src="all.js"></script>

Can be?:

<!-- htmlbuild:js -->
<!-- inject:js -->
<script src="all.js"></script>
<!-- endinject -->
<!-- endbuild  -->

Thanks to this we can go to development -> production and after return production -> development.

I don't know if this is the best method.

Cant chain to the htmlbuild task

I have below,

My issue is that the task HiThere NEVERS runs due to 'build' not returning. can you advise

gulp.task('build', function() {

  return gulp.src(['./index.html'])
    .pipe(
      htmlbuild({
        // build js with preprocessor
        js: htmlbuild.preprocess.js(function(block) {

          block.pipe(gulpSrc())
            // .pipe( print () )
            .pipe(jsBuild);

          block.end('js/concat.js');
        }),

        // build css with preprocessor
        css: htmlbuild.preprocess.css(function(block) {

          block.pipe(gulpSrc())
            .pipe(cssBuild);

          block.end('css/concat.css');

        }),

        // build css with preprocessor
        less: htmlbuild.preprocess.css(function(block) {

          block.pipe(gulpSrc())
            .pipe(lessBuild);

          block.end('less/concat.less');

        }),

        // remove blocks with this target
        remove: function(block) {
          block.end();
        },

        // add a template with this target
        template: function(block) {
          es.readArray([
            '<!--',
            '  processed by htmlbuild (' + block.args[0] + ')',
            '-->'
          ].map(function(str) {
            return block.indent + str;
          })).pipe(block);
        }
      }) // htmlbuild
    )
    .pipe(gulp.dest('./dist'))
});

gulp.task('HiThere', ['build'], function() {
  return gulp.src('./dist/js/concat.js')
    .pipe(uglify({
      mangle: false
    }))
    .pipe(gulp.dest('dist/js'))
});

Two task approach

Was looking around for a replacement to grunt-usemin and was directed towards your task.

I think you might have a better time taking the approach they use; a "prepare" task that grabs the files original paths, then your task that updates references.

Here's what I'm thinking:

gulp.task('dist', function () {

    var sourceFiles = gulp.src(['public/scripts/**/*.js']),
        htmlFiles = gulp.src(['*.html']);

    sourceFiles
        .pipe(htmlbuild.prepare())
        .pipe(concat())
        .pipe(uglify())
        .pipe(rev())
        .pipe(htmlbuild.update({
            html: htmlFiles
        }));
});

Any thoughts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.