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

Update files to work with new version of eyeglass #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
Binary file removed assets/.DS_Store
Binary file not shown.
Binary file removed assets/images/.DS_Store
Binary file not shown.
Binary file removed assets/images/buttons/.DS_Store
Binary file not shown.
Binary file removed assets/images/icons/.DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions assets/scss/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
// icon sprites
$icon-sprite-map: sprite-map('icon-sprite-map',
sprite-layout(horizontal, (spacing: 5px, alignment: bottom)),
// sprite-layout(vertical, (spacing: 50px, alignment: left)),
// sprite-layout(vertical, (spacing: 5px, alignment: left)),
// sprite-layout(diagonal, ()),
'images/icons/*');
'images/icons/*.png');

// @debug $icon-sprite-map;

Expand Down
50 changes: 20 additions & 30 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,44 @@ var fs = require("fs");
var fse = require("fs-extra");
var static = require('node-static');
var sass = require("node-sass");
var Eyeglass = require("eyeglass").Eyeglass;
var eyeglass = require("eyeglass");
var rootDir = __dirname;
var assetsDir = path.join(rootDir, "assets");
var buildDir = path.join(rootDir, "dist");
var inFile = path.join(rootDir, "assets", "scss", "app.scss")
var outFile = path.join(rootDir, "dist", "css", "app.css")

var options = {
// specifying root lets the script run from any directory instead of having to be in the same directory.
file: inFile
}

options.eyeglass = {
root: rootDir,

// where assets are installed by eyeglass to expose them according to their output url.
// If not provided, assets are not installed unless you provide a custom installer.
buildDir: buildDir,
// prefix to give assets for their output url.
assetsHttpPrefix: "assets",
// Sass file to compile.
file: inFile,
// always pass the output file for path resolution purposes.
outFile: outFile
buildDir: path.join(rootDir, "dist"),

assets: {
// prefix to give assets for their output url.
httpPrefix: "assets",

// Add assets except for js and sass files
// The url passed to asset-url should be
// relative to the assets directory specified.
sources: [
{directory: assetsDir, globOpts: { ignore: ["**/*.js", "**/*.scss"] }}
]
}
}

var eyeglass = new Eyeglass(options, sass);

// Add assets except for js and sass files
eyeglass.assets.addSource(assetsDir, {
globOpts: { ignore: ["**/*.js", "**/*.scss", "**/*.html"] }
});

eyeglass.assets.installer(function(assetFile, assetUri, oldInstaller, cb) {
// oldInstaller is the standard eyeglass installer in this case.
// We proxy to it for logging purposes.
oldInstaller(assetFile, assetUri, function(err, result) {
if (err) {
console.log("Error installing '" + assetFile + "': " + err.toString());
} else {
console.log("Installed Asset '" + assetFile + "' => '" + result + "'");
}
cb(err, result);
});
});

fse.mkdirsSync(buildDir);
fse.mkdirsSync(path.dirname(outFile));

fse.copySync(path.join(assetsDir, "html", "index.html"), path.join(buildDir, "index.html"));

// Standard node-sass rendering of a single file.
sass.render(eyeglass.sassOptions(), function(err, result) {
sass.render(eyeglass(options), function(err, result) {
if (err) {
throw err;
}
Expand Down
39 changes: 39 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
var gulp = require('gulp');
var sass = require('gulp-sass');
var eyeglass = require('eyeglass');
var path = require('path');

var rootDir = __dirname;
var assetsDir = path.join(rootDir, "assets");
var buildDir = path.join(rootDir, "dist");
var inFile = path.join(rootDir, "assets", "scss", "app.scss")
var outFile = path.join(rootDir, "dist", "css")

var options = {
eyeglass: {
// specifying root lets the script run from any directory instead of having to be in the same directory.
root: rootDir,

// where assets are installed by eyeglass to expose them according to their output url.
// If not provided, assets are not installed unless you provide a custom installer.
buildDir: path.join(rootDir, "dist"),

assets: {
// prefix to give assets for their output url.
httpPrefix: "assets",

// Add assets except for js and sass files
// The url passed to asset-url should be
// relative to the assets directory specified.
sources: [
{directory: assetsDir, globOpts: { ignore: ["**/*.js", "**/*.scss"] }}
]
}
}
}

gulp.task('sass', function () {
gulp.src(inFile)
.pipe(sass(eyeglass(options)))
.pipe(gulp.dest(outFile))
})
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"devDependencies": {
"node-sass": "*",
"gulp": "*",
"gulp-sass": "*",
"eyeglass": "*",
"eyeglass-spriting": "*",
"eyeglass-spriting": "git@github.com:sass-eyeglass/eyeglass-spriting.git",
"fs-extra": "*"
},
"dependencies": {
Expand Down