Code Monkey home page Code Monkey logo

Comments (14)

erikjung avatar erikjung commented on August 29, 2024

Regarding sandbox/demo page scripts, I'm wondering if webpack should even be used. It's purpose is to resolve modules and bundle them together...so it seems like adding more entries for individual pages is the wrong solution for simply making those scripts available.

What about figuring out some way to use the copy task to move the downloaded scripts into dist?

from drizzle.

gerardo-rodriguez avatar gerardo-rodriguez commented on August 29, 2024

Good point @erikjung. Seems worth considering for sure.

from drizzle.

tylersticka avatar tylersticka commented on August 29, 2024

Yeah, that's probably a better idea.

I don't even know if we'd need to do anything.

I'm pretty sure as long as the path is static/assets/scripts/toolkit/, it'll just merge with whatever else the build outputs to that directory.

from drizzle.

 avatar commented on August 29, 2024

What about using a custom toolkit setup different from Drizzle, is that possible? With my own browser-sync, watch, sass and webpack gulp tasks? I saw you have a drizzle-builder package, would that be the way to go?

Really looking forward to using Drizzle, this looks like the tool we've been searching for for our pattern library!

from drizzle.

erikjung avatar erikjung commented on August 29, 2024

@guilambert

What about using a custom toolkit setup different from Drizzle, is that possible?

Yes, you could in theory use a clone of this repo (or your own starting point) and simply include the drizzle-builder package (which is just a Promise-returning function) to handle the template/data/content compilation.

We plan to rewrite the builder to be a bit more flexible in general (for example, allowing more template options other than Handlebars).

from drizzle.

 avatar commented on August 29, 2024

@erikjung Thank you! I will give it a try and let you know.

from drizzle.

 avatar commented on August 29, 2024

So basically just have a copy of the content src directory, and then have my own tasks setup at the root along with drizzle-builder to handle the compilation?

from drizzle.

 avatar commented on August 29, 2024

Update, added drizzle-builder to my devDeps, added the following to my gulpfile (drizzleConfig is the same as the cloudfour-patterns one):

const drizzle = require('drizzle-builder');
const drizzleConfig = require('./config');
// Register Drizzle builder task
gulp.task('drizzle', () => {
  const result = drizzle(drizzleConfig.drizzle);
  return result;
});

And I get this stack error when running gulp drizzle:

Error: Missing helper: "timestamp"
    at Object.<anonymous> (/Users/guillaume/Sites/drizzle/node_modules/handlebars/dist/cjs/handlebars/helpers/helper-missing.js:19:13)
    at eval (eval at createFunctionContext (/Users/guillaume/Sites/drizzle/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), <anonymous>:8:76)
    at prog (/Users/guillaume/Sites/drizzle/node_modules/handlebars/dist/cjs/handlebars/runtime.js:219:12)
    at execIteration (/Users/guillaume/Sites/drizzle/node_modules/handlebars/dist/cjs/handlebars/helpers/each.js:51:19)
    at Object.<anonymous> (/Users/guillaume/Sites/drizzle/node_modules/handlebars/dist/cjs/handlebars/helpers/each.js:61:13)
    at eval (eval at createFunctionContext (/Users/guillaume/Sites/drizzle/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), <anonymous>:8:31)
    at Object.prog [as fn] (/Users/guillaume/Sites/drizzle/node_modules/handlebars/dist/cjs/handlebars/runtime.js:219:12)
    at fn (/Users/guillaume/Sites/drizzle/node_modules/handlebars-layouts/index.js:41:17)
    at Object.applyAction (/Users/guillaume/Sites/drizzle/node_modules/handlebars-layouts/index.js:54:11)
    at Array.reduce (native)
    at Object.helpers.block (/Users/guillaume/Sites/drizzle/node_modules/handlebars-layouts/index.js:171:43)
    at eval (eval at createFunctionContext (/Users/guillaume/Sites/drizzle/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), <anonymous>:5:90)
    at prog (/Users/guillaume/Sites/drizzle/node_modules/handlebars/dist/cjs/handlebars/runtime.js:219:12)
    at Object.helpers.block (/Users/guillaume/Sites/drizzle/node_modules/handlebars-layouts/index.js:173:5)
    at Object.eval (eval at createFunctionContext (/Users/guillaume/Sites/drizzle/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), <anonymous>:12:72)
    at main (/Users/guillaume/Sites/drizzle/node_modules/handlebars/dist/cjs/handlebars/runtime.js:173:32)

Thought the timestamp helper came from @cloudfour/hbs-helpers so I also installed it, but still no chance. Any idea what I'm missing?

Thank you

from drizzle.

erikjung avatar erikjung commented on August 29, 2024

@guilambert

Thought the timestamp helper came from @cloudfour/hbs-helpers so I also installed it, but still no chance. Any idea what I'm missing?

In addition to including that helpers package, you'll also need to pass the helpers along to the helpers property of the builder config.

The assignment is done in the Drizzle Gulpfile like this:

const drizzle = require('drizzle-builder');
const helpers = require('@cloudfour/hbs-helpers');
const config = require('./config');

Object.assign(config.drizzle, { helpers });

(https://github.com/cloudfour/drizzle/blob/master/gulpfile.js#L11-L12)

from drizzle.

 avatar commented on August 29, 2024

Funny I just saw that while looking at the gulpfile just at this very moment 😉

I will take another shot at it, thanks again!

from drizzle.

 avatar commented on August 29, 2024

Great the drizzle builder works now with that place.

Now I'm struggling with paths being outputted. My drizzle instance is located in resources/drizzle/, and I want to run the drizzle-builder from my root gulpfile.js:

const drizzle = require('drizzle-builder');
const helpers = require('@cloudfour/hbs-helpers');
const drizzleConfig = Object.assign({
  src: {
    data: {
      basedir: 'resources/drizzle/src/data',
      glob: 'resources/drizzle/src/data/**/*'
    },
    pages: {
      basedir: 'resources/drizzle/src/pages',
      glob: 'resources/drizzle/src/pages/**/*'
    },
    patterns: {
      basedir: 'resources/drizzle/src/patterns',
      glob: 'resources/drizzle/src/patterns/**/*.hbs'
    },
    templates: {
      basedir: 'resources/drizzle/src/templates',
      glob: 'resources/drizzle/src/templates/**/*.hbs'
    }
  },
  dest: {
    pages: './public/drizzle',
    patterns: './public/drizzle/patterns'
  }
}, { helpers });

// Register Drizzle builder task
gulp.task('drizzle', () => {
  const result = drizzle(drizzleConfig);
  return result;
});

I tried setting the basedir for each src by removing resources/drizzle/src/ but does not work. Both the path for building and the path outputted in those files are tied together, or is there a way I can have a custom "relative" path in the ouptut files for both pages and assets?

Thanks!

from drizzle.

erikjung avatar erikjung commented on August 29, 2024

@guilambert

Could you provide an example repo or a tree output of your directory structure? This path issue you're describing is likely something specific to the builder. Having something to test against will make this a bit easier to diagnose.

A few things to try:

  1. Prefix your relative paths with ./ (e.g. ./resources/drizzle...)

  2. Check how the relative paths are being resolved to absolute paths by adding this line to your gulp task:

    gulp.task('drizzle', () => {
      const result = drizzle(drizzleConfig);
      result.then(d => console.log(d.options.src));   // <==
      return result;
    });

from drizzle.

 avatar commented on August 29, 2024

Thanks @erikjung, will test that out and let you know. Appreciate the help, and hopefully I'll be able to give back soon to the project as I have ideas/suggestions for the project 😉

from drizzle.

tylersticka avatar tylersticka commented on August 29, 2024

Related: cloudfour/core-gulp-tasks#55

from drizzle.

Related Issues (20)

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.