Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Simplify front end file inclusion #146

Closed
sarahjean opened this issue Jun 13, 2016 · 5 comments
Closed

Simplify front end file inclusion #146

sarahjean opened this issue Jun 13, 2016 · 5 comments
Assignees

Comments

@sarahjean
Copy link

In filesets.xml, could we do something like this:

  <patternset id="files.frontend">
    <include name="js/**/*.js"/>
    <exclude name="**/vendor/**/*"/>
  </patternset>

So that we are going more specifically for theme js files and not ones that might exist in other folders?

@grasmash
Copy link
Contributor

@sarahjean Could you be more specific? The current patternset for files.frontend is:

  <patternset id="files.frontend">
    <include name="**/*.js"/>
    <!-- Ignore CSS. SASS usage is expected. CSS should be compiled. -->
    <exclude name="**/*.css"/>
    <exclude name="**/bower_components/**/*"/>
    <exclude name="**/css/**"/>
    <exclude name="**/dist/**/*"/>
    <exclude name="**/lib/**/*"/>
    <exclude name="**/node_modules/**/*"/>
    <exclude name="**/styleguide/**"/>
    <exclude name="**/vendor/**/*"/>
    <exclude name="**/gulpfile.js"/>
  </patternset>

This is including JS and is excluding a number of common third party directories. What is your goal? What should be excluded or included and why?

@sarahjean
Copy link
Author

sarahjean commented Jun 22, 2016

@grasmash Yes, currently it grabs any and all JS, I am suggesting that it specifically look at JS provided by the theme, in a /js or /scripts folder, that way this doesn't need to be modified to exclude JS that might be in locations other than that which might not need to conform to Drupal Coder conventions (third party libraries, additional gulp or grunt files, code in node_modules, etc...)
A specific case that came up is in addition to <exclude name="**/gulpfile.js"/>, there was a sub directory with gulp tasks being imported which needed to be added on. Since Drupal themes typical include a /js, /scripts, or similar folder if we specifically target that we won't need to do as many one-off excludes.

@sarahjean
Copy link
Author

@grasmash A slightly better version:

  <patternset id="files.frontend">
    <include name="**/js/**/*.js"/>
    <include name="**/js/**/*.min.js"/>
    <exclude name="**/node_modules/**/*"/>
    <exclude name="**/vendor/**/*"/>
  </patternset>

Not excluding node_modules caused some local performance issues when trying to run validate:phpcs

@grasmash
Copy link
Contributor

It seems odd that we should need to exclude node_modules. Was your node_modules dir nested under a js dir?

@sarahjean
Copy link
Author

@grasmash No, actually. I'm not sure what was happening there.

I think bigger picture it'd be good if this list could be updated via project.yml.

grasmash added a commit to grasmash/bolt that referenced this issue Aug 15, 2016
@grasmash grasmash self-assigned this Aug 15, 2016
grasmash added a commit to grasmash/bolt that referenced this issue Aug 15, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants