Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single entry #11

Open
ezekielchentnik opened this issue Sep 3, 2016 · 8 comments
Open

Single entry #11

ezekielchentnik opened this issue Sep 3, 2016 · 8 comments

Comments

@ezekielchentnik
Copy link

Is there a way to limit to a single entry point?

example: /client/entry.js (rollup bundles from entry)
ignores everything else in /client

@cognitom
Copy link
Owner

cognitom commented Sep 3, 2016

Hi @ezekielchentnik. Yep, we can use opts.patterns option:

// felt.config.js
module.exports = {
  patterns: ['entry.js']
}

Then, $ felt --src client --recipe minimal --config felt.config.js

See also https://github.com/cognitom/felt#optspatterns


updated: patterns is supposed to be relative from src directory.

@ezekielchentnik
Copy link
Author

ezekielchentnik commented Sep 4, 2016

@cognitom does not seem to work. when i specify the pattern, client/entry.js is not ran through rollup.

here is what I'm going for (I'm looking to use felt as middleware, then export if needed):

Source:

/src
    /images
        logo.png
    /components
        App.jsx
    /styles
        _partial.css
        global.css     # postcss's entry point
    entry.js           # rollup's entry point

Dist:

/dist
    /images       # entire directory copied
    entry.js      # bundle generated by rollup
    global.css    # bundle generated by postcss

@ezekielchentnik
Copy link
Author

@cognitom i've debugged and patterns solution works, however even when limiting by entry.js, files in sub folders are still copied, Is there a way to completely ignore a whole folder?

@ezekielchentnik
Copy link
Author

ezekielchentnik commented Sep 5, 2016

This appears to work:

module.exports = {
  patterns: ['entry.js'],
  excludes: ['components/*.js']
}

src

/src
    /components
        App.jsx
    entry.js

dist

/dist
    entry.js
felt --config felt.config.js --src src --export dist --debug

excludes seems to be un documented. Also, I'm attempting to figure out a better pattern for all sub folders under src

@ezekielchentnik
Copy link
Author

this pattern seems to work:

module.exports = {
   excludes: ['!entry.js', '**/']
}

@cognitom
Copy link
Owner

cognitom commented Sep 5, 2016

@ezekielchentnik perfectly right! Sorry for my misleading.
Yeah, we should add opts.exclude to the docs.

Also, I'm attempting to figure out a better pattern for all sub folders under src

I think, we could add option.ignoreUnmatchedFiles or something, but not self-explanatory...
Maybe, --no-copy option with --export could be simpler and readable. Thoughts?

@ezekielchentnik
Copy link
Author

@cognitom an option to whitelist folders may be a better option?

i like the option of --no-copy for simple opting out.

for more complex projects, maybe adding a whitelist opts.include to make it easier for large folder structures where only a small number of folders are needed.

src:

/src
    /images
    /components
    /store
    /reducers
    /actions
    /middleware
    /constants
    /vendor
    /styles
    /utils
    entry.js

dist:

/dist
    /vendor
    /images
    global.css
    entry.js

felt.config.js

module.exports = {
  patterns: ['entry.js', 'global.css'],
  exclude:[],
  include: ['images', 'vendor'],
  handlers: {
      '.js': rollup(),
      '.css': postcss()
    }
}

cognitom added a commit that referenced this issue Sep 6, 2016
@cognitom
Copy link
Owner

cognitom commented Sep 6, 2016

Yeah, opts.includes seems popular option for this kind of tool. I like the idea. Thanks for your suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants