reustyle 2.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.drone.yml +17 -0
- data/.gitignore +25 -0
- data/.nvmrc +1 -0
- data/.rbenv-gemsets +1 -0
- data/.ruby-version +1 -0
- data/CONTRIBUTING.md +68 -0
- data/Gemfile +4 -0
- data/Gruntfile.js +234 -0
- data/LICENSE.txt +13 -0
- data/README.md +196 -0
- data/Rakefile +6 -0
- data/bower.json +54 -0
- data/config/autoprefixer.yml +6 -0
- data/config/scss-lint.yml +55 -0
- data/dist/icons.svg +1 -0
- data/dist/ustyle-content.css +1 -0
- data/dist/ustyle-latest.css +1 -0
- data/dist/ustyle.js +567 -0
- data/dist/ustyle.json +1 -0
- data/dist/ustyle.min.js +1 -0
- data/grunt/modules/dss-helper.js +115 -0
- data/grunt/modules/file.js +24 -0
- data/grunt/modules/html-parser.js +22 -0
- data/grunt/modules/templates.js +57 -0
- data/grunt/tasks/browser-sync.js +23 -0
- data/grunt/tasks/builder.js +67 -0
- data/grunt/tasks/styleguide.js +299 -0
- data/index.js +37 -0
- data/lib/ustyle/deploy.rb +41 -0
- data/lib/ustyle/engine.rb +32 -0
- data/lib/ustyle/hash.rb +44 -0
- data/lib/ustyle/helpers/icon_helper.rb +15 -0
- data/lib/ustyle/icons.rb +13 -0
- data/lib/ustyle/middleware/icon_middleware.rb +27 -0
- data/lib/ustyle/sass_functions.rb +65 -0
- data/lib/ustyle/sinatra.rb +34 -0
- data/lib/ustyle/sprockets.rb +6 -0
- data/lib/ustyle/utils.rb +42 -0
- data/lib/ustyle/version.rb +4 -0
- data/lib/ustyle.rb +58 -0
- data/package-lock.json +9303 -0
- data/package.json +89 -0
- data/styleguide/CNAME +1 -0
- data/styleguide/assets/images/CTAs.png +0 -0
- data/styleguide/assets/images/badge-label-usp.png +0 -0
- data/styleguide/assets/images/bower-logo.png +0 -0
- data/styleguide/assets/images/caveat.png +0 -0
- data/styleguide/assets/images/cloudfront-logo.png +0 -0
- data/styleguide/assets/images/design-conventions.png +0 -0
- data/styleguide/assets/images/error-texts.png +0 -0
- data/styleguide/assets/images/external-requirements.png +0 -0
- data/styleguide/assets/images/favicon/android-chrome-192x192.png +0 -0
- data/styleguide/assets/images/favicon/android-chrome-512x512.png +0 -0
- data/styleguide/assets/images/favicon/apple-touch-icon-114x114.png +0 -0
- data/styleguide/assets/images/favicon/apple-touch-icon-120x120.png +0 -0
- data/styleguide/assets/images/favicon/apple-touch-icon-144x144.png +0 -0
- data/styleguide/assets/images/favicon/apple-touch-icon-152x152.png +0 -0
- data/styleguide/assets/images/favicon/apple-touch-icon-180x180.png +0 -0
- data/styleguide/assets/images/favicon/apple-touch-icon-57x57.png +0 -0
- data/styleguide/assets/images/favicon/apple-touch-icon-60x60.png +0 -0
- data/styleguide/assets/images/favicon/apple-touch-icon-72x72.png +0 -0
- data/styleguide/assets/images/favicon/apple-touch-icon-76x76.png +0 -0
- data/styleguide/assets/images/favicon/apple-touch-icon.png +0 -0
- data/styleguide/assets/images/favicon/browserconfig.xml +9 -0
- data/styleguide/assets/images/favicon/favicon-16x16.png +0 -0
- data/styleguide/assets/images/favicon/favicon-32x32.png +0 -0
- data/styleguide/assets/images/favicon/favicon.ico +0 -0
- data/styleguide/assets/images/favicon/manifest.json +18 -0
- data/styleguide/assets/images/favicon/mstile-144x144.png +0 -0
- data/styleguide/assets/images/favicon/mstile-150x150.png +0 -0
- data/styleguide/assets/images/favicon/mstile-310x150.png +0 -0
- data/styleguide/assets/images/favicon/mstile-310x310.png +0 -0
- data/styleguide/assets/images/favicon/mstile-70x70.png +0 -0
- data/styleguide/assets/images/favicon/safari-pinned-tab.svg +46 -0
- data/styleguide/assets/images/icons.svg +1 -0
- data/styleguide/assets/images/infographic-01.png +0 -0
- data/styleguide/assets/images/infographic-02.png +0 -0
- data/styleguide/assets/images/npm-logo.png +0 -0
- data/styleguide/assets/images/placeholder-text.png +0 -0
- data/styleguide/assets/images/ruby-logo.png +0 -0
- data/styleguide/assets/images/site-consistency01.png +0 -0
- data/styleguide/assets/images/site-consistency02.png +0 -0
- data/styleguide/assets/images/site-consistency03.png +0 -0
- data/styleguide/assets/images/styleguide-examples/accurate-housing.jpg +0 -0
- data/styleguide/assets/images/styleguide-examples/altered.jpg +0 -0
- data/styleguide/assets/images/styleguide-examples/bad-subject.jpg +0 -0
- data/styleguide/assets/images/styleguide-examples/centered.jpg +0 -0
- data/styleguide/assets/images/styleguide-examples/cliche.jpg +0 -0
- data/styleguide/assets/images/styleguide-examples/cold.jpg +0 -0
- data/styleguide/assets/images/styleguide-examples/good-subject.jpg +0 -0
- data/styleguide/assets/images/styleguide-examples/illustrations_1.png +0 -0
- data/styleguide/assets/images/styleguide-examples/illustrations_2.png +0 -0
- data/styleguide/assets/images/styleguide-examples/illustrations_3.png +0 -0
- data/styleguide/assets/images/styleguide-examples/illustrations_4.png +0 -0
- data/styleguide/assets/images/styleguide-examples/illustrations_5.png +0 -0
- data/styleguide/assets/images/styleguide-examples/illustrations_6.png +0 -0
- data/styleguide/assets/images/styleguide-examples/innaccurate-housing.jpg +0 -0
- data/styleguide/assets/images/styleguide-examples/natural-1.jpg +0 -0
- data/styleguide/assets/images/styleguide-examples/natural-2.jpg +0 -0
- data/styleguide/assets/images/styleguide-examples/natural-3.jpg +0 -0
- data/styleguide/assets/images/styleguide-examples/not-centered.jpg +0 -0
- data/styleguide/assets/images/styleguide-examples/realistic.jpg +0 -0
- data/styleguide/assets/images/styleguide-examples/unaltered.jpg +0 -0
- data/styleguide/assets/images/styleguide-examples/unnatural-1.jpg +0 -0
- data/styleguide/assets/images/styleguide-examples/unnatural-2.jpg +0 -0
- data/styleguide/assets/images/styleguide-examples/unnatural-3.jpg +0 -0
- data/styleguide/assets/images/styleguide-examples/warm.jpg +0 -0
- data/styleguide/assets/images/tone-framework.png +0 -0
- data/styleguide/assets/images/tone.png +0 -0
- data/styleguide/assets/images/tooltip.png +0 -0
- data/styleguide/assets/images/tsandcs.png +0 -0
- data/styleguide/assets/images/ustyle.svg +73 -0
- data/styleguide/assets/images/ux-conventions-consistency.png +0 -0
- data/styleguide/assets/images/ux-conventions-error.png +0 -0
- data/styleguide/assets/images/ux-conventions-errors.png +0 -0
- data/styleguide/assets/images/ux-conventions-flexibility.png +0 -0
- data/styleguide/assets/images/ux-conventions-freedom.png +0 -0
- data/styleguide/assets/images/ux-conventions-minimalist.png +0 -0
- data/styleguide/assets/images/ux-conventions-real-world.png +0 -0
- data/styleguide/assets/images/ux-conventions-recognition.png +0 -0
- data/styleguide/assets/images/ux-conventions-visibility.png +0 -0
- data/styleguide/assets/javascripts/app.js +115 -0
- data/styleguide/assets/javascripts/modules/stats.js +50 -0
- data/styleguide/assets/javascripts/vendor/highlight.js +1 -0
- data/styleguide/assets/javascripts/vendor/svg4everybody.js +1 -0
- data/styleguide/assets/sass/main.scss +42 -0
- data/styleguide/assets/sass/modules/_code.scss +8 -0
- data/styleguide/assets/sass/modules/_colours.scss +26 -0
- data/styleguide/assets/sass/modules/_copyright.scss +4 -0
- data/styleguide/assets/sass/modules/_grid.scss +12 -0
- data/styleguide/assets/sass/modules/_home.scss +5 -0
- data/styleguide/assets/sass/modules/_images.scss +24 -0
- data/styleguide/assets/sass/modules/_links.scss +3 -0
- data/styleguide/assets/sass/modules/_logo.scss +182 -0
- data/styleguide/assets/sass/modules/_made-at.scss +6 -0
- data/styleguide/assets/sass/modules/_markdown.scss +7 -0
- data/styleguide/assets/sass/modules/_nav-mobile.scss +72 -0
- data/styleguide/assets/sass/modules/_nav.scss +32 -0
- data/styleguide/assets/sass/modules/_sidebar.scss +94 -0
- data/styleguide/assets/sass/modules/_states.scss +4 -0
- data/styleguide/assets/sass/modules/_styleguide.scss +138 -0
- data/styleguide/assets/sass/modules/_table.scss +3 -0
- data/styleguide/assets/sass/modules/_tooltip.scss +9 -0
- data/styleguide/assets/sass/modules/_typography.scss +14 -0
- data/styleguide/assets/sass/modules/_version.scss +11 -0
- data/styleguide/assets/sass/structure/_base.scss +18 -0
- data/styleguide/assets/sass/structure/_header.scss +12 -0
- data/styleguide/assets/sass/vendor/_highlight.scss +139 -0
- data/styleguide/assets/sass/vendor/_pure-table.scss +75 -0
- data/styleguide/content/brand/index.md +47 -0
- data/styleguide/content/brand/logo.tpl +279 -0
- data/styleguide/content/design/accessibility-testing.md +82 -0
- data/styleguide/content/design/index.tpl +367 -0
- data/styleguide/content/design/typography.md +68 -0
- data/styleguide/content/design/validating-designs.tpl +304 -0
- data/styleguide/content/index.tpl +51 -0
- data/styleguide/content/language/grammar.md +220 -0
- data/styleguide/content/language/microcopy.md +170 -0
- data/styleguide/content/language/tone.md +135 -0
- data/styleguide/content/pattern-library/grid.tpl +64 -0
- data/styleguide/content/pattern-library/index.tpl +88 -0
- data/styleguide/partials/_footer.tpl +8 -0
- data/styleguide/partials/_head.tpl +26 -0
- data/styleguide/partials/_header.tpl +37 -0
- data/styleguide/partials/_sidebar.tpl +27 -0
- data/styleguide/partials/colour.tpl +24 -0
- data/styleguide/partials/icons.tpl +28 -0
- data/styleguide/partials/style_block.tpl +44 -0
- data/styleguide/templates/simple.tpl +25 -0
- data/styleguide/templates/stats.tpl +50 -0
- data/styleguide/templates/styleguide.tpl +36 -0
- data/tasks/publish.rake +67 -0
- data/ustyle.gemspec +32 -0
- data/vendor/assets/images/forms/checkbox-rebrand.svg +1 -0
- data/vendor/assets/images/forms/checkbox.svg +1 -0
- data/vendor/assets/images/icons/alarm.svg +1 -0
- data/vendor/assets/images/icons/android.svg +1 -0
- data/vendor/assets/images/icons/arrow-circle.svg +1 -0
- data/vendor/assets/images/icons/arrow-down.svg +1 -0
- data/vendor/assets/images/icons/arrow-up.svg +1 -0
- data/vendor/assets/images/icons/book.svg +1 -0
- data/vendor/assets/images/icons/bookmark.svg +1 -0
- data/vendor/assets/images/icons/breadcrumb.svg +1 -0
- data/vendor/assets/images/icons/calculator.svg +1 -0
- data/vendor/assets/images/icons/calendar.svg +1 -0
- data/vendor/assets/images/icons/car.svg +1 -0
- data/vendor/assets/images/icons/checkbox-tick.svg +1 -0
- data/vendor/assets/images/icons/chevron-left.svg +1 -0
- data/vendor/assets/images/icons/chevron-right.svg +1 -0
- data/vendor/assets/images/icons/clock.svg +1 -0
- data/vendor/assets/images/icons/close.svg +1 -0
- data/vendor/assets/images/icons/cog.svg +1 -0
- data/vendor/assets/images/icons/controller.svg +1 -0
- data/vendor/assets/images/icons/credit-card.svg +1 -0
- data/vendor/assets/images/icons/cross.svg +1 -0
- data/vendor/assets/images/icons/dashcam.svg +1 -0
- data/vendor/assets/images/icons/dual-fuel.svg +1 -0
- data/vendor/assets/images/icons/electric-light.svg +1 -0
- data/vendor/assets/images/icons/envelope.svg +1 -0
- data/vendor/assets/images/icons/exit-noexit.svg +1 -0
- data/vendor/assets/images/icons/facebook-brand.svg +1 -0
- data/vendor/assets/images/icons/facebook.svg +1 -0
- data/vendor/assets/images/icons/filter.svg +1 -0
- data/vendor/assets/images/icons/fixed-variable.svg +1 -0
- data/vendor/assets/images/icons/gas.svg +1 -0
- data/vendor/assets/images/icons/gauge.svg +1 -0
- data/vendor/assets/images/icons/github.svg +1 -0
- data/vendor/assets/images/icons/google-brand.svg +1 -0
- data/vendor/assets/images/icons/google.svg +1 -0
- data/vendor/assets/images/icons/graph-up.svg +1 -0
- data/vendor/assets/images/icons/home.svg +1 -0
- data/vendor/assets/images/icons/hot.svg +1 -0
- data/vendor/assets/images/icons/info.svg +1 -0
- data/vendor/assets/images/icons/kettle.svg +1 -0
- data/vendor/assets/images/icons/key.svg +1 -0
- data/vendor/assets/images/icons/lock.svg +1 -0
- data/vendor/assets/images/icons/magnify-in.svg +1 -0
- data/vendor/assets/images/icons/magnify.svg +1 -0
- data/vendor/assets/images/icons/menu.svg +1 -0
- data/vendor/assets/images/icons/message.svg +1 -0
- data/vendor/assets/images/icons/mobile.svg +1 -0
- data/vendor/assets/images/icons/monthly-dd.svg +1 -0
- data/vendor/assets/images/icons/network.svg +1 -0
- data/vendor/assets/images/icons/no-exit.svg +1 -0
- data/vendor/assets/images/icons/pdf.svg +1 -0
- data/vendor/assets/images/icons/pencil.svg +1 -0
- data/vendor/assets/images/icons/person-add.svg +1 -0
- data/vendor/assets/images/icons/person.svg +1 -0
- data/vendor/assets/images/icons/phone.svg +1 -0
- data/vendor/assets/images/icons/piggy-bank.svg +1 -0
- data/vendor/assets/images/icons/pin.svg +1 -0
- data/vendor/assets/images/icons/play.svg +1 -0
- data/vendor/assets/images/icons/pound-circle.svg +1 -0
- data/vendor/assets/images/icons/pound-note.svg +1 -0
- data/vendor/assets/images/icons/present.svg +1 -0
- data/vendor/assets/images/icons/print.svg +1 -0
- data/vendor/assets/images/icons/quarterly-dd.svg +1 -0
- data/vendor/assets/images/icons/question-circle.svg +1 -0
- data/vendor/assets/images/icons/quote.svg +1 -0
- data/vendor/assets/images/icons/recycle.svg +1 -0
- data/vendor/assets/images/icons/remove.svg +1 -0
- data/vendor/assets/images/icons/renewable.svg +1 -0
- data/vendor/assets/images/icons/results.svg +1 -0
- data/vendor/assets/images/icons/save.svg +1 -0
- data/vendor/assets/images/icons/share.svg +1 -0
- data/vendor/assets/images/icons/shield.svg +1 -0
- data/vendor/assets/images/icons/sim.svg +1 -0
- data/vendor/assets/images/icons/smiley.svg +1 -0
- data/vendor/assets/images/icons/sort.svg +1 -0
- data/vendor/assets/images/icons/speech-circle.svg +1 -0
- data/vendor/assets/images/icons/speech.svg +1 -0
- data/vendor/assets/images/icons/spinner-rebrand.svg +1 -0
- data/vendor/assets/images/icons/spinner.svg +1 -0
- data/vendor/assets/images/icons/star-half.svg +1 -0
- data/vendor/assets/images/icons/star.svg +1 -0
- data/vendor/assets/images/icons/starline-half.svg +1 -0
- data/vendor/assets/images/icons/starline.svg +1 -0
- data/vendor/assets/images/icons/talk.svg +1 -0
- data/vendor/assets/images/icons/tick-circle.svg +1 -0
- data/vendor/assets/images/icons/tick.svg +1 -0
- data/vendor/assets/images/icons/tv.svg +1 -0
- data/vendor/assets/images/icons/twitter-brand.svg +1 -0
- data/vendor/assets/images/icons/twitter.svg +1 -0
- data/vendor/assets/images/icons/ustyle.svg +1 -0
- data/vendor/assets/images/icons/uswitch.svg +1 -0
- data/vendor/assets/images/icons/variable.svg +1 -0
- data/vendor/assets/images/icons/warning-circle.svg +1 -0
- data/vendor/assets/images/icons/warning.svg +1 -0
- data/vendor/assets/images/icons/wifi.svg +1 -0
- data/vendor/assets/images/icons/wiki.svg +1 -0
- data/vendor/assets/images/icons/xml.svg +1 -0
- data/vendor/assets/images/icons.svg +1 -0
- data/vendor/assets/javascripts/ustyle/backdrop.js +56 -0
- data/vendor/assets/javascripts/ustyle/classtoggler.js +76 -0
- data/vendor/assets/javascripts/ustyle/overlay.js +152 -0
- data/vendor/assets/javascripts/ustyle/tabs.js +166 -0
- data/vendor/assets/javascripts/ustyle/utils.js +113 -0
- data/vendor/assets/javascripts/ustyle.js +4 -0
- data/vendor/assets/stylesheets/rebrand-content.scss +1 -0
- data/vendor/assets/stylesheets/rebrand.scss +1 -0
- data/vendor/assets/stylesheets/ustyle/_all.scss +55 -0
- data/vendor/assets/stylesheets/ustyle/_content.scss +5 -0
- data/vendor/assets/stylesheets/ustyle/_global.scss +20 -0
- data/vendor/assets/stylesheets/ustyle/articles/_base.scss +100 -0
- data/vendor/assets/stylesheets/ustyle/articles/_guide.scss +57 -0
- data/vendor/assets/stylesheets/ustyle/articles/_more.scss +31 -0
- data/vendor/assets/stylesheets/ustyle/articles/_news.scss +213 -0
- data/vendor/assets/stylesheets/ustyle/articles/_related.scss +76 -0
- data/vendor/assets/stylesheets/ustyle/basics/_extends.scss +73 -0
- data/vendor/assets/stylesheets/ustyle/basics/_fonts.scss +27 -0
- data/vendor/assets/stylesheets/ustyle/basics/_functions.scss +78 -0
- data/vendor/assets/stylesheets/ustyle/basics/_grid.scss +86 -0
- data/vendor/assets/stylesheets/ustyle/basics/_typography.scss +123 -0
- data/vendor/assets/stylesheets/ustyle/basics/_variables.scss +166 -0
- data/vendor/assets/stylesheets/ustyle/basics/variables/_colors.scss +94 -0
- data/vendor/assets/stylesheets/ustyle/basics/variables/_forms.scss +98 -0
- data/vendor/assets/stylesheets/ustyle/basics/variables/_icons.scss +43 -0
- data/vendor/assets/stylesheets/ustyle/components/_backdrop.scss +23 -0
- data/vendor/assets/stylesheets/ustyle/components/_breadcrumbs.scss +66 -0
- data/vendor/assets/stylesheets/ustyle/components/_button.scss +187 -0
- data/vendor/assets/stylesheets/ustyle/components/_calculator.scss +41 -0
- data/vendor/assets/stylesheets/ustyle/components/_comp-table-row.scss +341 -0
- data/vendor/assets/stylesheets/ustyle/components/_compliance-banner.scss +38 -0
- data/vendor/assets/stylesheets/ustyle/components/_content-group.scss +33 -0
- data/vendor/assets/stylesheets/ustyle/components/_cta.scss +66 -0
- data/vendor/assets/stylesheets/ustyle/components/_grid-classes.scss +52 -0
- data/vendor/assets/stylesheets/ustyle/components/_hero.scss +115 -0
- data/vendor/assets/stylesheets/ustyle/components/_links.scss +26 -0
- data/vendor/assets/stylesheets/ustyle/components/_lists-li.scss +92 -0
- data/vendor/assets/stylesheets/ustyle/components/_lists.scss +39 -0
- data/vendor/assets/stylesheets/ustyle/components/_loader.scss +139 -0
- data/vendor/assets/stylesheets/ustyle/components/_overlay.scss +183 -0
- data/vendor/assets/stylesheets/ustyle/components/_progress.scss +138 -0
- data/vendor/assets/stylesheets/ustyle/components/_promo-banner.scss +131 -0
- data/vendor/assets/stylesheets/ustyle/components/_reminder.scss +87 -0
- data/vendor/assets/stylesheets/ustyle/components/_tab-navigation.scss +114 -0
- data/vendor/assets/stylesheets/ustyle/components/_table-toolbar.scss +91 -0
- data/vendor/assets/stylesheets/ustyle/components/_tabs.scss +300 -0
- data/vendor/assets/stylesheets/ustyle/components/_tooltip.scss +243 -0
- data/vendor/assets/stylesheets/ustyle/components/_usp.scss +88 -0
- data/vendor/assets/stylesheets/ustyle/content/_base.scss +227 -0
- data/vendor/assets/stylesheets/ustyle/content/_c-header.scss +27 -0
- data/vendor/assets/stylesheets/ustyle/content/_c-social.scss +9 -0
- data/vendor/assets/stylesheets/ustyle/content/_c-tabs.scss +30 -0
- data/vendor/assets/stylesheets/ustyle/forms/_base.scss +9 -0
- data/vendor/assets/stylesheets/ustyle/forms/_fields.scss +78 -0
- data/vendor/assets/stylesheets/ustyle/forms/_input-group.scss +154 -0
- data/vendor/assets/stylesheets/ustyle/forms/_input.scss +61 -0
- data/vendor/assets/stylesheets/ustyle/forms/_radio-checkbox.scss +144 -0
- data/vendor/assets/stylesheets/ustyle/forms/_reset.scss +21 -0
- data/vendor/assets/stylesheets/ustyle/forms/_select.scss +154 -0
- data/vendor/assets/stylesheets/ustyle/forms/_textarea.scss +33 -0
- data/vendor/assets/stylesheets/ustyle/forms/_toggle.scss +114 -0
- data/vendor/assets/stylesheets/ustyle/forms/_validation.scss +104 -0
- data/vendor/assets/stylesheets/ustyle/icons/_base.scss +241 -0
- data/vendor/assets/stylesheets/ustyle/mixins/_arrow.scss +51 -0
- data/vendor/assets/stylesheets/ustyle/mixins/_base.scss +7 -0
- data/vendor/assets/stylesheets/ustyle/mixins/_baseline.scss +43 -0
- data/vendor/assets/stylesheets/ustyle/mixins/_forms.scss +84 -0
- data/vendor/assets/stylesheets/ustyle/mixins/_general.scss +24 -0
- data/vendor/assets/stylesheets/ustyle/mixins/_link-colors.scss +44 -0
- data/vendor/assets/stylesheets/ustyle/mixins/_media-query.scss +121 -0
- data/vendor/assets/stylesheets/ustyle/mixins/_typography.scss +98 -0
- data/vendor/assets/stylesheets/ustyle/tables/_base.scss +4 -0
- data/vendor/assets/stylesheets/ustyle/tables/_tables-basic.scss +72 -0
- data/vendor/assets/stylesheets/ustyle/tables/_tables-sortable.scss +72 -0
- data/vendor/assets/stylesheets/ustyle/tables/_tables-with-key-cells.scss +18 -0
- data/vendor/assets/stylesheets/ustyle/tables/_variables.scss +15 -0
- data/vendor/assets/stylesheets/ustyle/utilities/_general.scss +116 -0
- data/vendor/assets/stylesheets/ustyle/utilities/_grid.scss +13 -0
- data/vendor/assets/stylesheets/ustyle/utilities/_images.scss +34 -0
- data/vendor/assets/stylesheets/ustyle/utilities/_responsive.scss +101 -0
- data/vendor/assets/stylesheets/ustyle/utilities/_spacing.scss +73 -0
- data/vendor/assets/stylesheets/ustyle/vendor/normalize.scss +427 -0
- data/vendor/assets/stylesheets/ustyle-content.scss +2 -0
- data/vendor/assets/stylesheets/ustyle.scss +1 -0
- metadata +517 -0
@@ -0,0 +1,41 @@
|
|
1
|
+
require "aws-sdk"
|
2
|
+
require "time"
|
3
|
+
|
4
|
+
module Ustyle
|
5
|
+
REGION = 'eu-west-1'
|
6
|
+
BUCKET = 'uswitch-assets-eu'
|
7
|
+
CLOUDFRONT_DISTRIBUTION = 'E3F1XI0HIG20E0'
|
8
|
+
|
9
|
+
ONE_YEAR_IN_S = 1 * 365 * 24 * 60 * 60
|
10
|
+
ONE_YEAR_FROM_NOW = Time.now + ONE_YEAR_IN_S
|
11
|
+
|
12
|
+
def self.s3_upload to, from, content_type, bucket = BUCKET
|
13
|
+
bucket = s3.bucket(bucket)
|
14
|
+
object = bucket.object(to)
|
15
|
+
object.put(
|
16
|
+
body: open(from),
|
17
|
+
content_type: content_type,
|
18
|
+
acl: 'public-read',
|
19
|
+
cache_control: "max-age=#{ONE_YEAR_IN_S}, public",
|
20
|
+
expires: ONE_YEAR_FROM_NOW.httpdate
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.invalidate files
|
25
|
+
cloudfront = Aws::CloudFront::Client.new(region: REGION)
|
26
|
+
cloudfront.create_invalidation(
|
27
|
+
distribution_id: CLOUDFRONT_DISTRIBUTION,
|
28
|
+
invalidation_batch: {
|
29
|
+
paths: {
|
30
|
+
quantity: files.length,
|
31
|
+
items: files
|
32
|
+
},
|
33
|
+
caller_reference: "ustyle invalidation at #{Time.now.to_s}"
|
34
|
+
}
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.s3
|
39
|
+
@conn ||= Aws::S3::Resource.new(region: REGION)
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'autoprefixer-rails'
|
2
|
+
|
3
|
+
module Ustyle
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
add_paths_block = lambda { |app|
|
6
|
+
Ustyle.asset_directories.each do |asset_directory|
|
7
|
+
app.config.assets.paths << File.join(Ustyle.assets_path, asset_directory)
|
8
|
+
end
|
9
|
+
}
|
10
|
+
|
11
|
+
initializer "ustyle.assets.precompile" do |app|
|
12
|
+
app.config.assets.precompile += %w( icons/**.* icons.svg forms/*.svg)
|
13
|
+
end
|
14
|
+
|
15
|
+
initializer "ustyle.update_asset_paths", &add_paths_block
|
16
|
+
initializer "ustyle.update_asset_paths", group: :assets, &add_paths_block
|
17
|
+
end
|
18
|
+
|
19
|
+
class Railtie < ::Rails::Railtie
|
20
|
+
if config.respond_to?(:assets) and not config.assets.nil?
|
21
|
+
config.assets.configure do |env|
|
22
|
+
AutoprefixerRails.install(env, Ustyle.autoprefixer_config)
|
23
|
+
end
|
24
|
+
else
|
25
|
+
initializer :setup_autoprefixer, group: :all do |app|
|
26
|
+
if defined? app.assets and not app.assets.nil?
|
27
|
+
AutoprefixerRails.install(app.assets, Ustyle.autoprefixer_config)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/ustyle/hash.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# taken from activesupport-4.1.7/lib/active_support/core_ext/hash/keys.rb
|
2
|
+
class Hash
|
3
|
+
# Returns a new hash with all keys converted using the block operation.
|
4
|
+
#
|
5
|
+
# hash = { name: 'Rob', age: '28' }
|
6
|
+
#
|
7
|
+
# hash.transform_keys{ |key| key.to_s.upcase }
|
8
|
+
# # => {"NAME"=>"Rob", "AGE"=>"28"}
|
9
|
+
def transform_keys
|
10
|
+
result = {}
|
11
|
+
each_key do |key|
|
12
|
+
result[yield(key)] = self[key]
|
13
|
+
end
|
14
|
+
result
|
15
|
+
end
|
16
|
+
|
17
|
+
# Destructively convert all keys using the block operations.
|
18
|
+
# Same as transform_keys but modifies +self+.
|
19
|
+
def transform_keys!
|
20
|
+
keys.each do |key|
|
21
|
+
self[yield(key)] = delete(key)
|
22
|
+
end
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
26
|
+
# Returns a new hash with all keys converted to symbols, as long as
|
27
|
+
# they respond to +to_sym+.
|
28
|
+
#
|
29
|
+
# hash = { 'name' => 'Rob', 'age' => '28' }
|
30
|
+
#
|
31
|
+
# hash.symbolize_keys
|
32
|
+
# # => { name: "Rob", age: "28" }
|
33
|
+
def symbolize_keys
|
34
|
+
transform_keys{ |key| key.to_sym rescue key }
|
35
|
+
end
|
36
|
+
alias_method :to_options, :symbolize_keys
|
37
|
+
|
38
|
+
# Destructively convert all keys to symbols, as long as they respond
|
39
|
+
# to +to_sym+. Same as +symbolize_keys+, but modifies +self+.
|
40
|
+
def symbolize_keys!
|
41
|
+
transform_keys!{ |key| key.to_sym rescue key }
|
42
|
+
end
|
43
|
+
alias_method :to_options!, :symbolize_keys!
|
44
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative '../utils'
|
2
|
+
|
3
|
+
module Ustyle
|
4
|
+
module Helpers
|
5
|
+
module Icons
|
6
|
+
def self.icon(name, size, color, role ='presentation', pseudo = false, classes = [])
|
7
|
+
"
|
8
|
+
<svg class='us-icon--#{name} us-icon--#{color} us-icon--#{size} #{pseudo ? "us-icon--#{pseudo}" : ""} #{classes.join(' ') unless classes.nil?}' role='#{role}' xmlns='http://www.w3.org/2000/svg'>
|
9
|
+
<use xlink:href='/icons.svg#icon-#{name}'></use>
|
10
|
+
</svg>
|
11
|
+
"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/ustyle/icons.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
module Ustyle
|
2
|
+
module Icons
|
3
|
+
def self.loader svg_css_path, png_css_path
|
4
|
+
"
|
5
|
+
<script>
|
6
|
+
var svgCSSPath = '#{svg_css_path}',
|
7
|
+
pngCSSPath = '#{png_css_path}';
|
8
|
+
var isSVG=!!document.createElementNS&&!!document.createElementNS(\"http://www.w3.org/2000/svg\",\"svg\").createSVGRect&&!!document.implementation.hasFeature(\"http://www.w3.org/TR/SVG11/feature#Image\",\"1.1\")&&!(window.opera&&-1===navigator.userAgent.indexOf(\"Chrome\"))&&-1===navigator.userAgent.indexOf(\"Series40\");function loadCSSAsync(e){function f(){for(var b,c=0;c<d.length;c++)d[c].href&&-1<d[c].href.indexOf(e)&&(b=!0);b?a.media=\"all\":setTimeout(f)}var a=window.document.createElement(\"link\"),b=window.document.getElementsByTagName(\"script\")[0],d=window.document.styleSheets;a.rel=\"stylesheet\";a.href=e;a.media=\"only x\";a.onload=null;b.parentNode.insertBefore(a,b);f();return a}var img=new Image;img.onload=function(){isSVG?loadCSSAsync(svgCSSPath):loadCSSAsync(pngCSSPath)};img.src=\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==\";
|
9
|
+
</script>
|
10
|
+
"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'net/http'
|
3
|
+
require 'ustyle/utils'
|
4
|
+
|
5
|
+
module Ustyle
|
6
|
+
class IconMiddleware
|
7
|
+
def initialize(app, options = {})
|
8
|
+
@app = app
|
9
|
+
@icon_path = options[:path] || Ustyle.cloudfront_url("icons.svg", :icon, false, false)
|
10
|
+
end
|
11
|
+
|
12
|
+
def call(env)
|
13
|
+
request = Rack::Request.new(env)
|
14
|
+
if request.path == "/icons.svg"
|
15
|
+
[200, {"Content-Type" => "image/svg+xml"}, [serve_icons.to_s]]
|
16
|
+
else
|
17
|
+
@app.call(env)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def serve_icons
|
22
|
+
uri = URI(@icon_path)
|
23
|
+
res = Net::HTTP.get_response(uri)
|
24
|
+
res.body
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require "sass"
|
2
|
+
require "cgi"
|
3
|
+
require "base64"
|
4
|
+
|
5
|
+
module Sass::Script::Functions
|
6
|
+
|
7
|
+
def ustyle_version
|
8
|
+
::Sass::Script::String.new ::Ustyle::VERSION
|
9
|
+
end
|
10
|
+
declare :ustyle_version, []
|
11
|
+
|
12
|
+
def inline_svg(source)
|
13
|
+
assert_type source, :String
|
14
|
+
if Ustyle.sprockets?
|
15
|
+
svg = escaped_svg(sprockets_context.environment.find_asset(source.value).to_s)
|
16
|
+
::Sass::Script::String.new "url(data:#{Ustyle.mime_type_for(source.value)};charset=utf-8,#{svg})"
|
17
|
+
else
|
18
|
+
path = File.join(::Ustyle.assets_path, "images", source.value)
|
19
|
+
asset_data_uri(path, svg = true)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
declare :inline_svg, :args => [:source]
|
23
|
+
|
24
|
+
def base64encode(string)
|
25
|
+
assert_type string, :String
|
26
|
+
Sass::Script::String.new(Base64.strict_encode64(string.value))
|
27
|
+
end
|
28
|
+
declare :base64encode, :args => [:string]
|
29
|
+
|
30
|
+
protected
|
31
|
+
|
32
|
+
def asset_data_uri(path, svg = false)
|
33
|
+
asset = data(path)
|
34
|
+
encoding = "base64"
|
35
|
+
if svg
|
36
|
+
asset = escaped_svg(asset)
|
37
|
+
encoding = "charset=utf-8"
|
38
|
+
else
|
39
|
+
asset = CGI::escape(Base64.strict_encode64(data(path).to_s))
|
40
|
+
end
|
41
|
+
url = "data:#{Ustyle.mime_type_for(path)};#{encoding},#{asset}"
|
42
|
+
::Sass::Script::String.new "url('#{url}')"
|
43
|
+
end
|
44
|
+
|
45
|
+
def escaped_svg(data)
|
46
|
+
CGI::escape(data).gsub('+', '%20')
|
47
|
+
end
|
48
|
+
|
49
|
+
def data(path)
|
50
|
+
File.open(path, "rb") {|io| io.read}
|
51
|
+
end
|
52
|
+
|
53
|
+
def sprockets_context
|
54
|
+
# Modern Rails way to get context:
|
55
|
+
if options.key?(:sprockets)
|
56
|
+
options[:sprockets][:context]
|
57
|
+
# Sprockets-sass context:
|
58
|
+
elsif options.key?(:custom) && options[:custom].key?(:sprockets_context)
|
59
|
+
options[:custom][:sprockets_context]
|
60
|
+
# Compatibility with sprockets pre 2.10.0:
|
61
|
+
elsif (importer = options[:importer]) && importer.respond_to?(:context)
|
62
|
+
importer.context
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
if defined?(::Sinatra)
|
2
|
+
module Sinatra
|
3
|
+
module Ustyle
|
4
|
+
def self.registered app
|
5
|
+
app.set :root, Dir.pwd
|
6
|
+
app.set :sprockets, ::Ustyle.sprockets_env
|
7
|
+
app.set :assets_prefix, %w(assets)
|
8
|
+
app.set :assets_path, File.join(app.root, "app", app.assets_prefix.join)
|
9
|
+
app.set :public_folder, File.join(app.root, "public")
|
10
|
+
app.set :assets_helper_path, "/assets"
|
11
|
+
app.set :static, true
|
12
|
+
app.set :assets_digest, true
|
13
|
+
|
14
|
+
# Setup Sprockets
|
15
|
+
::Ustyle.asset_directories.each do |asset_directory|
|
16
|
+
app.sprockets.append_path File.join(app.assets_path, asset_directory)
|
17
|
+
end
|
18
|
+
|
19
|
+
Sprockets::Helpers.configure do |config|
|
20
|
+
config.environment = app.sprockets
|
21
|
+
config.prefix = app.assets_helper_path
|
22
|
+
config.digest = app.assets_digest
|
23
|
+
config.public_path = app.public_folder
|
24
|
+
end
|
25
|
+
|
26
|
+
require 'autoprefixer-rails'
|
27
|
+
AutoprefixerRails.install(app.sprockets, ::Ustyle.autoprefixer_config)
|
28
|
+
|
29
|
+
app.helpers Sprockets::Helpers
|
30
|
+
end
|
31
|
+
end
|
32
|
+
register Ustyle
|
33
|
+
end
|
34
|
+
end
|
data/lib/ustyle/utils.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'digest'
|
2
|
+
require 'mime/types'
|
3
|
+
|
4
|
+
module Ustyle
|
5
|
+
|
6
|
+
def self.production?
|
7
|
+
ENV['RACK_ENV'] == 'production' || ENV['RAILS_ENV'] == 'production' || ENV['NODE_ENV'] == 'production' || false
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.cloudfront_url path, type, versioned = true, digest = true
|
11
|
+
File.join "https://assets0.uswitch.com/s3/uswitch-assets-eu/ustyle/",
|
12
|
+
(versioned ? Ustyle::VERSION : ""),
|
13
|
+
folder_by_type(type),
|
14
|
+
(digest ? asset_digest(path) : path)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.asset_digest path
|
18
|
+
path.sub(/\.(\w+)$/) { |ext| "-#{digest}#{ext}" }
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.mime_type_for asset
|
22
|
+
MIME::Types.type_for( asset ).first.content_type
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.versioned_path file
|
26
|
+
File.join "ustyle", Ustyle::VERSION, file
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.digest
|
30
|
+
Digest::SHA1.hexdigest Ustyle::VERSION
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.folder_by_type type
|
34
|
+
case type
|
35
|
+
when :image
|
36
|
+
"images"
|
37
|
+
when :font
|
38
|
+
"fonts"
|
39
|
+
else ""
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/ustyle.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
dir = File.dirname(__FILE__)
|
2
|
+
$LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
|
3
|
+
|
4
|
+
require "ustyle/version"
|
5
|
+
require "ustyle/utils"
|
6
|
+
require "ustyle/hash"
|
7
|
+
require "ustyle/middleware/icon_middleware"
|
8
|
+
|
9
|
+
module Ustyle
|
10
|
+
class << self
|
11
|
+
def load!
|
12
|
+
require "ustyle/sass_functions"
|
13
|
+
require "ustyle/icons"
|
14
|
+
require "ustyle/helpers/icon_helper"
|
15
|
+
|
16
|
+
if rails?
|
17
|
+
require "ustyle/engine"
|
18
|
+
elsif sprockets?
|
19
|
+
require "ustyle/sprockets"
|
20
|
+
require "ustyle/sinatra"
|
21
|
+
end
|
22
|
+
|
23
|
+
::Sass.load_paths << File.join(assets_path, "stylesheets")
|
24
|
+
end
|
25
|
+
|
26
|
+
def sprockets?
|
27
|
+
defined?(::Sprockets)
|
28
|
+
end
|
29
|
+
|
30
|
+
def rails?
|
31
|
+
defined?(::Rails)
|
32
|
+
end
|
33
|
+
|
34
|
+
def gem_path
|
35
|
+
@gem_path ||= File.expand_path "..", File.dirname(__FILE__)
|
36
|
+
end
|
37
|
+
|
38
|
+
def assets_path
|
39
|
+
@assets_path ||= File.join gem_path, "vendor", "assets"
|
40
|
+
end
|
41
|
+
|
42
|
+
def asset_directories
|
43
|
+
%w(stylesheets javascripts images fonts)
|
44
|
+
end
|
45
|
+
|
46
|
+
def sprockets_env
|
47
|
+
@sprockets_env ||= ::Sprockets::Environment.new
|
48
|
+
end
|
49
|
+
|
50
|
+
def autoprefixer_config
|
51
|
+
file = File.join Ustyle.gem_path, 'config/autoprefixer.yml'
|
52
|
+
params = YAML.load_file(file).symbolize_keys
|
53
|
+
params
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
Ustyle.load!
|