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

Collecticons V4 #19

Merged
merged 20 commits into from
Feb 2, 2019
Merged

Collecticons V4 #19

merged 20 commits into from
Feb 2, 2019

Conversation

danielfdsilva
Copy link
Member

@danielfdsilva danielfdsilva commented Jan 29, 2019

  • Ensure the new Collecticons library is ready and deployed.

Release notes below the fold


Collecticons Processor v4.0.0 was completely written from the ground up.
It doesn't rely on gulp and its plugins anymore, leveraging the font creation modules directly. This results in a smaller and simpler codebase, easier to maintain and test. Although the functionality is practically the same, some of the commands changed. See the migration guide below.

Changelog

  • Remove gulp and gulp related dependencies
  • Remove grid command as it is no longer needed with the new collecticons library
  • Add programatic api to use compile and bundle commands.
  • Remove support for ttf and eot fonts
  • Add support fot woff2 font
  • Embed the font by default instead of outputting to file
  • Rename --no-placeholder to --no-sass-placeholder
  • Rename --no-standalone to --no-css-class
  • Sass filename no longer prefixed with _. This will have to be explicitely set with --style-name _icons, for example.
  • Use Circle CI instead of travis for continuous integration
  • Update dependencies
  • Improve documentation
  • Correctly handle situation when there are no icons in given folder (Unclear error when there are no icons #8)
  • Add --experimental-font-on-catalog and --experimental-disable-styles flags.

Migration guide

⚠️Some of the default values changed. Check the README for the new values.⚠️

Default behavior

The previous default behavior ($ collecticons compile source/) included the eot, ttf, and woff and did not embed the fonts.
This can now be achieved with the following (with the exception of eot and ttf support which was dropped).

$ collecticons compile source/ --font-types woff --font-dest collecticons/font/ --style-name _icons

Gulp

Since this new version of Collecticons Processor includes a programatic API, it is no longer required to use a child process when integrating with gulp.

gulp.task('collecticons', function (done) {
  var args = [
    'node_modules/collecticons-processor/bin/collecticons.js',
    'compile',
    'app/assets/icons/collecticons/',
    '--font-embed',
    '--font-dest', 'app/assets/fonts',
    '--font-name', 'Collecticons',
    '--font-types', 'woff',
    '--style-format', 'sass',
    '--style-dest', 'app/assets/styles/core/',
    '--style-name', 'collecticons',
    '--class-name', 'collecticon',
    '--author-name', 'Development Seed',
    '--author-url', 'https://developmentseed.org/',
    '--no-preview'
  ];

  return cp.spawn('node', args, { stdio: 'inherit' })
    .on('close', done);
});

The above code can now be written as:

const { compile } = require('collecticons-processor');
gulp.task('collecticons', function () {
  return compile({
    dirPath: 'app/assets/icons/collecticons/',
    fontName: 'Collecticons',
    // fontTypes is now woff2 which is compatible with modern browsers.
    styleDest: 'app/assets/styles/core/',
    styleName: '_collecticons', // sass no longer prefixed with _
    preview: false
  });
});

Experimental features

The flags --experimental-font-on-catalog and --experimental-disable-styles were added as a first experiment to have collecticons work with styled-components. They are still being tested out and the API is likely to change. Use at your own risk

@danielfdsilva danielfdsilva force-pushed the feature/v4 branch 19 times, most recently from 4a1f902 to c436417 Compare January 29, 2019 11:57
@danielfdsilva danielfdsilva force-pushed the feature/v4 branch 11 times, most recently from 3bff2a0 to 7957ee8 Compare January 29, 2019 12:55
@danielfdsilva
Copy link
Member Author

Fix #8

@danielfdsilva danielfdsilva requested a review from vgeorge January 29, 2019 14:40
Copy link
Member

@vgeorge vgeorge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are passing locally and I could generate a debug bundle successfully. Added some minor changes, mostly fixing typos.

Seems DEVELOPMENT.md isn't linked anywhere, I suggest to delete it as there are testing instructions at the README.

src/utils.js Outdated Show resolved Hide resolved
src/utils.js Outdated Show resolved Hide resolved
src/core/bundle.js Outdated Show resolved Hide resolved
src/core/compile.js Outdated Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
vgeorge and others added 4 commits January 31, 2019 11:01
Co-Authored-By: danielfdsilva <daniel@developmentseed.org>
- Adds font to the catalog
- Disables the style output
Default to font value to undefined so it is removed from the stringified json
@danielfdsilva danielfdsilva changed the title [WIP] Collecticons V4 Collecticons V4 Feb 2, 2019
@danielfdsilva danielfdsilva merged commit e7679e9 into master Feb 2, 2019
@danielfdsilva danielfdsilva deleted the feature/v4 branch February 2, 2019 12:28
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