Skip to content
This repository has been archived by the owner on Apr 13, 2019. It is now read-only.

update Bourbon to 4.3.4 -> 5.0.0 #172

Merged
merged 5 commits into from Jan 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion pom.xml
Expand Up @@ -144,7 +144,7 @@
<jruby.version>9.1.15.0</jruby.version>
<maven-libs.version>3.5.2</maven-libs.version>
<scss-lint.version>0.56.0</scss-lint.version>
<bourbon.version>4.3.4</bourbon.version>
<bourbon.version>5.0.0</bourbon.version>
<maven.version />
<debug>true</debug>
<github.username />
Expand Down Expand Up @@ -302,6 +302,10 @@
<exclude>**/test/**</exclude>
<exclude>**/examples/**</exclude>
<exclude>**/src/**</exclude>
<exclude>.github/**</exclude>
<exclude>**/*.json</exclude>
<exclude>**/*.md</exclude>
<exclude>**/*.js</exclude>
</excludes>
</resource>
<resource>
Expand Down
Expand Up @@ -59,6 +59,9 @@
*/
public abstract class AbstractSassMojo extends AbstractMojo {

private static final String BOURBON_GEM_PATH = "core";
private static final String BOURBON_DEST_PATH = "bourbon";

/**
* Build directory for the plugin.
*
Expand Down Expand Up @@ -274,7 +277,7 @@ protected void buildBasicSassScript(final StringBuilder sassScript)
/* remove trailing comma+\n */
sassScript.setLength(sassScript.length() - 2);
// TODO
// quick fix for the deprecation message coming from Gem.paths, this should be cleaned up;
// quick fix for the deprecation message coming from Gem.paths, this should be cleaned up;
// there's a round trip of splitting into array in java and then unsplitting the array in ruby...
// see #118
sassScript.append("\n].uniq.join(File::PATH_SEPARATOR) }\n");
Expand Down Expand Up @@ -338,12 +341,11 @@ protected void buildBasicSassScript(final StringBuilder sassScript)

if (this.useBourbon) {
log.info("Running with Bourbon enabled.");
final String bDest = this.buildDirectory + "/bourbon";
final String bDest = this.buildDirectory + "/bourbon-lib";
this.extractBourbonResources(bDest);
// sassScript.append("require 'bourbon'\n");
sassScript.append("Sass::Plugin.add_template_location('")
.append(bDest)
.append("/app/assets/stylesheets', '")
.append("', '")
.append(destination).append("')\n");
}

Expand Down Expand Up @@ -440,21 +442,23 @@ private void extractBourbonResources(String destinationDir) {
File jarFile = new File(new URI(jarFileURI));
JarFile jar = new JarFile(jarFile);

// extract app/assets/stylesheets to destinationDir
// extract bourbon to destinationDir
for (Enumeration<JarEntry> enums = jar.entries(); enums.hasMoreElements();) {
JarEntry entry = enums.nextElement();

if (entry.getName().contains("app/assets/stylesheets")) {
if (entry.getName().contains(BOURBON_GEM_PATH) || entry.getName().contains("_bourbon.scss")) {
// shorten the path a bit
index = entry.getName().indexOf("app/assets/stylesheets");
index = entry.getName().indexOf(BOURBON_GEM_PATH);
String fileName = destinationDir + File.separator + entry.getName().substring(index);

File f = new File(fileName);
File f = new File(fileName.replace(BOURBON_GEM_PATH,BOURBON_DEST_PATH));
if (fileName.endsWith("/")) {
log.debug("create Bourbon directory: " + f);
f.mkdirs();
} else {
FileOutputStream fos = new FileOutputStream(f);
try {
// log.debug(" extract Bourbon file " + entry.getName() + " to " + f);
IOUtil.copy(jar.getInputStream(entry), fos);
} finally {
IOUtil.close(fos);
Expand Down
3 changes: 3 additions & 0 deletions src/site/apt/releasenotes.apt.vm
Expand Up @@ -39,6 +39,9 @@ ${project.name} ${project.version} Release Notes

~~ * Update JRuby to ${project.properties.get("jruby.version")}

* Update Bourbon to version ${project.properties.get("bourbon.version")}, please check the
{{{https://github.com/thoughtbot/bourbon/blob/master/CHANGELOG.md}Bourbon changelog}}

* Update Sass to version ${project.properties.get("sass.version")}, please check
the {{{http://sass-lang.com/documentation/file.SASS_CHANGELOG.html}Sass changelog}}

Expand Down
20 changes: 6 additions & 14 deletions src/test/projects/maven-bourbon-test/expected.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/test/projects/maven-bourbon-test/expected.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -1,6 +1,24 @@
@import "bourbon";

@include font-face("Helvetica", "/fonts");
@include font-face("Verdana", "/assets/fonts", "bold", "italic");
@include font-face("Georgia", "/assets", "normal", "normal", false);
@include font-face("Arial", "/", "normal", "normal", false, woff2 svg);
@import "bourbon/bourbon";


@include font-face(
"Helvetica",
"/fonts"
);

@include font-face(
"Verdana",
"/assets/fonts"
) {
font-weight: bold;
font-style: italic;
};

@include font-face(
"Arial",
"/",
("woff2", "svg")
) {
font-weight: normal;
font-style: normal;
};