Skip to content
This repository was archived by the owner on Jan 23, 2021. It is now read-only.

Commit f7234e1

Browse files
author
Rob Wierzbowski
committed
Merge pull request #137 from sindresorhus/rw/1.0
Gulp source adapter, release 1.0
2 parents 15e806b + 3ebbe9f commit f7234e1

18 files changed

+674
-319
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1+
# Managed packages
12
node_modules
3+
4+
# Temp files
25
.sass-cache
6+
7+
# Test artifacts
8+
fixture/maps

fixture/component/_obj-2.scss

Lines changed: 0 additions & 3 deletions
This file was deleted.

fixture/gulpfile.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
'use strict';
2+
3+
var gulp = require('gulp');
4+
var sourcemaps = require('gulp-sourcemaps');
5+
var sass = require('../');
6+
7+
// inline sourcemaps
8+
gulp.task('sass-inline', function() {
9+
return sass('source', { sourcemap: true, verbose: true })
10+
.on('error', function (err) {
11+
console.error('Error!', err.message);
12+
})
13+
.pipe(sourcemaps.write())
14+
.pipe(gulp.dest('result'));
15+
});
16+
17+
// file sourcemaps
18+
gulp.task('sass-file', function() {
19+
return sass('source', { sourcemap: true })
20+
.on('error', function (err) {
21+
console.error('Error!', err.message);
22+
})
23+
24+
.pipe(sourcemaps.write('../maps', {
25+
includeContent: false,
26+
sourceRoot: '/fixture/source'
27+
}))
28+
29+
.pipe(gulp.dest('result'));
30+
});

fixture/index.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!doctype HTML>
2+
<html>
3+
4+
<head>
5+
<title></title>
6+
<link rel="stylesheet" href="/fixture/result/fixture-a.css">
7+
<link rel="stylesheet" href="/fixture/result/nested/fixture-b.css">
8+
</head>
9+
10+
<body>
11+
<h1>Example of a simple HTML page</h1>
12+
13+
<h2>For manually testing sourcemaps</h2>
14+
15+
<ol>
16+
<li>Open a shell in the repo root directory.</li>
17+
<li>Serve the root directory with <code>python -m SimpleHTTPServer</code>.</li>
18+
<li><code>cd</code> to <code>fixture/</code>.</li>
19+
<li>Run <code>gulp sass-inline</code> for inline sourcemaps, or <code>gulp sass-file</code> for file based sourcemaps.</li>
20+
<li>Open <a href="http://localhost:8000/fixture/">http://localhost:8000/fixture/</a> (this page) in a browser and inspect the source.</li>
21+
</ol>
22+
23+
<p>Hypertext Markup Language (HTML) is the most common language used to
24+
create documents on the World Wide Web. HTML uses hundreds of different
25+
tags to define a layout for web pages. Most tags require an opening &lt;tag&gt;
26+
and a closing &lt;/tag&gt;.</p>
27+
28+
</body>
29+
</html>

fixture/result/fixture-a.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
h1 .link {
2+
color: green; }
3+
4+
html {
5+
font-size: 16px;
6+
line-height: 24px; }
7+
8+
body {
9+
color: black;
10+
content: 'local imported mixin';
11+
content: 'imported mixin'; }

fixture/result/fixture-error.css

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
Error: File to import not found or unreadable: i-dont-exist.
3+
Load path: /Users/robw/Documents/Contrib/gulp-ruby-sass/fixture/source
4+
on line 1 of fixture/source/fixture-error.scss
5+
6+
1: @import 'i-dont-exist';
7+
8+
Backtrace:
9+
fixture/source/fixture-error.scss:1
10+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/import_node.rb:66:in `rescue in import'
11+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/import_node.rb:45:in `import'
12+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/import_node.rb:28:in `imported_file'
13+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/import_node.rb:37:in `css_import?'
14+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/visitors/perform.rb:301:in `visit_import'
15+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/visitors/base.rb:36:in `visit'
16+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/visitors/perform.rb:158:in `block in visit'
17+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/stack.rb:79:in `block in with_base'
18+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/stack.rb:115:in `with_frame'
19+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/stack.rb:79:in `with_base'
20+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/visitors/perform.rb:158:in `visit'
21+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/visitors/base.rb:52:in `block in visit_children'
22+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/visitors/base.rb:52:in `map'
23+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/visitors/base.rb:52:in `visit_children'
24+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/visitors/perform.rb:167:in `block in visit_children'
25+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/visitors/perform.rb:179:in `with_environment'
26+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/visitors/perform.rb:166:in `visit_children'
27+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/visitors/base.rb:36:in `block in visit'
28+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/visitors/perform.rb:186:in `visit_root'
29+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/visitors/base.rb:36:in `visit'
30+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/visitors/perform.rb:157:in `visit'
31+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/visitors/perform.rb:8:in `visit'
32+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/root_node.rb:36:in `css_tree'
33+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/tree/root_node.rb:20:in `render'
34+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/engine.rb:268:in `render'
35+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/plugin/compiler.rb:491:in `update_stylesheet'
36+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/plugin/compiler.rb:215:in `block in update_stylesheets'
37+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/plugin/compiler.rb:209:in `each'
38+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/plugin/compiler.rb:209:in `update_stylesheets'
39+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/plugin.rb:82:in `update_stylesheets'
40+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/exec/sass_scss.rb:350:in `watch_or_update'
41+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/exec/sass_scss.rb:50:in `process_result'
42+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/exec/base.rb:52:in `parse'
43+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/lib/sass/exec/base.rb:19:in `parse!'
44+
/Library/Ruby/Gems/2.0.0/gems/sass-3.4.5/bin/sass:13:in `<top (required)>'
45+
/usr/bin/sass:23:in `load'
46+
/usr/bin/sass:23:in `<main>'
47+
*/
48+
body:before {
49+
white-space: pre;
50+
font-family: monospace;
51+
content: "Error: File to import not found or unreadable: i-dont-exist.\A Load path: /Users/robw/Documents/Contrib/gulp-ruby-sass/fixture/source\A on line 1 of fixture/source/fixture-error.scss\A \A 1: @import 'i-dont-exist';"; }

fixture/result/nested/fixture-b.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
h1 .link {
2+
color: green; }
3+
4+
h2 {
5+
content: 'imported mixin'; }
File renamed without changes.
File renamed without changes.

fixture/source/component/_obj-2.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@mixin baz() {
2+
content: 'imported mixin';
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.i-had-spaces {
2+
background: pink;
3+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)