Skip to content

Remove referencesOthers toggle#12

Closed
RobLoach wants to merge 1 commit intodocpad:masterfrom
RobLoach:fix/referencesOthers
Closed

Remove referencesOthers toggle#12
RobLoach wants to merge 1 commit intodocpad:masterfrom
RobLoach:fix/referencesOthers

Conversation

@RobLoach
Copy link
Copy Markdown
Contributor

The referenceOthers toggle is as follows:

# Add Reference Others if this document does
# As lesscss concats imports
file.setMetaDefaults('referencesOthers': true)  if opts.content.indexOf('@import') isnt -1

This tells DocPad to rebuild all documents if @import is anywhere in the document. There are two cases of using a @import in a LESS file:

  1. Importing a LESS file. This will make LESS concatinate and re-build the LESS file for us.
  2. Importing a CSS file. LESS will ignore concatenation and just leave the CSS as a CSS import.

In either case, it seems like LESS will do the work for us, DocPad does not have to rebuild anything else. We don't need the referencesOthers toggle at all, since LESS does the rebuilding for us. I suggest we remove it, and just default to referencesOthers false. LESS handles importing/building LESS files for us.

@balupton
Copy link
Copy Markdown
Member

The issue here is the other way round.

If I modify _blah.css.less I'd expect DocPad to re-render include-blah.css.less.

So far the only way we can do this, is the dumb way of setting include-blah.css.less as referencesOthers: true.

Ideally, we'd be a lot smarter about this, and know that include-blah.css.less only includes _blah.css.less so when _blah.css.less is changed, we only re-render _blah.css.less

balupton added a commit that referenced this pull request Mar 28, 2017
Changes from @sdomagala work on this:

- remove `/docs` as there are no docs for this plugin
- update base files to latest conventions
- linting fixes, including spaces to tabs
- re-added the history to `HISTORY.md`
- removed `docpad` from `engines` as it is in `peerDependencies` which
is the new place
- moved from `import` to `require` so the source can run on node
- moved from `Object.assign` to `extendr` - docpad already uses extendr
so this reduces complexity
- update editions for latest standard and correct syntax
- removed superfluous dev dependencies
- fixed plugin configuration not being used - should be `get
initialConfig` for ES6 classes
- `paths` option was not an array when it should be, now fixed
- the `Object.assign` was writing to the wrong object, as it should be
updating `parseOptions` to send to the render
- made the `compress` option useful again, as it became useless when
`compileOptions` was removed
- added source maps #10
- added ability to disable referencesOthers #12
- added tests to show the importance of referencesOthers, source maps,
and compression

Still todo:

- This should probably be merged into master via a squash merge, to
avoid comitting things that were not needed
- Also need to determine if the renames for the coffeescript to esnext
occurred correctly such that history is preserved

Thanks everyone for your assistance on this. Greatly appreciated and
well done.
balupton added a commit that referenced this pull request Mar 29, 2017
Merges in the v2.5.0 changes into the current master:
https://github.com/docpad/docpad-plugin-less/tree/8ee72b49e0bd2787b12eb408481ee55251fb0e25

Squash merge to avoid comitting things that were not needed.

@sdomagala's work:

- less v1.6 to v2.6 upgrade
- coffeescript to esnext conversion
- update base files

@balupton's modifications:

- remove `/docs` as there are no docs for this plugin
- update base files to latest conventions
- linting fixes, including spaces to tabs
- re-added the history to `HISTORY.md`
- removed `docpad` from `engines` as it is in `peerDependencies` which
is the new place
- moved from `import` to `require` so the source can run on node
- moved from `Object.assign` to `extendr` - docpad already uses extendr
so this reduces complexity
- update editions for latest standard and correct syntax
- removed superfluous dev dependencies
- fixed plugin configuration not being used - should be `get
initialConfig` for ES6 classes
- `paths` option was not an array when it should be, now fixed
- the `Object.assign` was writing to the wrong object, as it should be
updating `parseOptions` to send to the render
- made the `compress` option useful again, as it became useless when
`compileOptions` was removed
- added source maps #10
- added ability to disable referencesOthers #12
- added tests to show the importance of referencesOthers, source maps,
and compression
- disable source maps for tests as the results will always be different

Thanks everyone for your assistance on this. Greatly appreciated and
well done.
@balupton
Copy link
Copy Markdown
Member

balupton commented Mar 29, 2017

config option added in the now released v2.5.0

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

Successfully merging this pull request may close these issues.

2 participants